• Resolved ErwinS

    (@erwins)


    After uploading an image to a new post on WP3.9 post_parent is not set. So the attachment is not linked to the new post. How to resolve this issue?

    After selecting “uploaded to this post” a lot of images are shown.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Have you tried:

    – deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems.

    resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

    – re-uploading all files & folders – except the wp-content folder and wp-config.php & root .htaccess files – from a fresh download of WordPress. Make sure that you delete the old copies of files & folder before uploading the new ones.

    Thread Starter ErwinS

    (@erwins)

    I detected which plugin breaks the post-parent. Unfortunately it happens after enabling wordpress-seo plugin. Also if this plugin is the only active plugin post_parent is still set to 0. Although this does not happen with twentyfourteen. So I will investigate my custom theme.

    Thanks in advance

    Thread Starter ErwinS

    (@erwins)

    After some debugging I noticed “wp_print_media_templates” has been changed since WP3.8.3. If I now add {{ data.postId }} to the header “Drop files anywhere to upload” for uploading images I get an empty response on 3.9, although on 3.8.3 I still get the ID of the main-post (parent). This happens with and without WordPress SEO enabled. Can someone explain how a new attachment is linked to a post on WP3.9? This will help me searching for a sollution. Thanks.

    Thread Starter ErwinS

    (@erwins)

    I found out that if in your theme in functions.php “add_themesupport(‘post_thumbnails’)” is set post_parent is also correctly set. Will test this on several other themes as well.

    Did you find out what was causing the problem for you? I’ve noticed the same error on my site a few days ago. The workaround with add_themesupport fixed things for the moment.

    On my installation, I’ve tracked it down to having WP Ultimate Recipe activated. Do you also use that plugin? Or is this a separate condition only accidentally triggered by different people in various ways.

    Thread Starter ErwinS

    (@erwins)

    I did not use this plugin. The themes on which this occurred were all custom made and fairly old.

    Thanks! In the meantime, I have found an existing ticket for the problem https://core.trac.www.ads-software.com/ticket/28219

    I am developing a theme. post_parent is reverting pack to the attachment itself. I am using twentyfourteen’s function here:

    <p class="small byline">
      Parent Post (for this attachment):
      <span class="parent-post-link">
       <a href="<?php echo get_permalink( $post->post_parent ); ?>" rel="gallery">
    	<?php echo get_the_title( $post->post_parent ); ?>
       </a>
      </span>
    </p>

    I am using add_theme_support( 'post-thumbnails' ); as well.

    Any ideas? :/

    OK, as I was typing this I was trying this out.

    This problem only happens when I was using a previously uploaded gallery. No images were found to be attached.

    I added a new post (post-format: gallery) and added a few pictures in it, the above code now prints the post parent!

    Now I wonder if this problem is bigger than it looks: what if someone installs my theme, and already has gallery-format posts? Will this code not work for them? Hmmm… Maybe WP somewhere “Builds” this, and one can do a “refresh” of all gallery items and post->parent vars?

    Akkkhh! :/

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘post_parent not set on WP3.9’ is closed to new replies.