ThemeShaper Forums » Thematic


Post meta function broken in WP 3.2.1

(1 post)
  • Started 12 years ago by candregg
  • This topic is not resolved
  1. Thanks to help from this forum, I got a nifty post-meta function to work beautifully in WordPress 3.1.3. Sadly, when the client upgraded his WP installation to WordPress 3.2.1, suddenly the function is throwing duplicate info.

    Please reference the 3.1.3 installation at, and the 3.2.1 installation at, for reference.

    The post-meta purpose is to add specific marketing info beneath posted testimonials by client companies. Each post includes custom fields SPONSOR and SPONSORLINK. The function code is as follows:

    // ADD optional content when available
    function add_after_content($content) {
      global $post;
      $sponsortext = get_post_meta($post->ID , 'sponsor', true);
      $sponsorlink = get_post_meta($post->ID , 'sponsorlink', true);
      if($sponsortext && $sponsorlink){
        $sponsor = '<div id="sponsor">';
        $sponsor .= ''.$sponsortext.'
        $sponsor .= 'For more information visit the website, <a href="http://'.$sponsorlink.'" target="_blank">http://'.$sponsorlink.'</a>
        $sponsor .= '</div>';
        $content .= $sponsor ;
      return $content;
    add_filter('the_content', add_after_content);

    As you can see, in the WP 3.1.3, it works just fine. In the WP 3.2.1 installation, each post shows the SPONSOR and SPONSORLINK info twice: the first instance appears to be the correct info; the second would appear to be the first/sticky post's SPONSOR and SPONSORLINK info repeated under every post.

    Could something in the new version's "Make Sticky" function be causing the repeat, or might it be something in the actual function code that is now broken according to the new WP version? Or other?

    UPDATE: I tried the simple solution of removing the "make sticky" designator from that one post. It didn't help a thing, so the "Make Sticky" function is not the culpret. The repeating info all comes from the first post made.

    Any help/ideas would be appreaciated.

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.