[wp-trac] Re: [WordPress Trac] #9868: the_title(), the_content(), the_permalink(), etc inconsistencies

WordPress Trac wp-trac at lists.automattic.com
Tue May 19 00:24:14 GMT 2009


#9868: the_title(), the_content(), the_permalink(), etc inconsistencies
-------------------------+--------------------------------------------------
 Reporter:  archon810    |       Owner:            
     Type:  enhancement  |      Status:  new       
 Priority:  normal       |   Milestone:  Unassigned
Component:  General      |     Version:  2.7.1     
 Severity:  normal       |    Keywords:            
-------------------------+--------------------------------------------------

Comment(by archon810):

 OK, I got it all sorted now. Here is the final outcome, for whoever is
 interested:

     * Each post's data can be accessed via iterating through the array
 returned by get_posts(), but this data will just be whatever is in the
 database, without passing through any intermediate filters
     * The preferred way is to access data using get_the_ functions and
 them wrapping them in an call to apply_filters() with the appropriate
 filter. This way, all intermediate filters will be applied.


 {{{
 apply_filters('the_permalink', get_permalink())
 }}}


     * the reason why get_the_content() was returning an empty string is
 that apparently a special call to setup_postdata($post); needs to be done
 first. Then get_the_content() returns data properly.

 Am I on the right track here?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9868#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list