[wp-trac] [WordPress Trac] #14275: excerpt_more filter does not follow $post even after setup_postdata($post)

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 12 09:36:39 UTC 2010


#14275: excerpt_more filter does not follow $post even after setup_postdata($post)
--------------------------+-------------------------------------------------
 Reporter:  jimmynguyc    |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  3.0            
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 A simple test by returning the $post-ID in the filter function and this is
 what I get :

 {{{
 // Default single post with ID 22

 if (have_posts()) : while (have_posts()) : the_post();
     the_content();
 endwhile; endif;


 // Additional custom query
 add_filter('excerpt_more',create_function('',"return $post->ID;"));

 $myposts = get_posts($args);

 foreach ($myposts as $post) : setup_postdata($post);
     echo $post->ID; // gives 519
     the_excerpt();  // shows 22 instead of 519
 endforeach;
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14275>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list