[wp-trac] [WordPress Trac] #12745: Call to undefined function get_post_thumbnail_id()

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 28 21:48:40 UTC 2010


#12745: Call to undefined function get_post_thumbnail_id()
--------------------------+-------------------------------------------------
 Reporter:  dphiffer      |       Owner:                   
     Type:  defect (bug)  |      Status:  new              
 Priority:  normal        |   Milestone:  Unassigned       
Component:  General       |     Version:                   
 Severity:  normal        |    Keywords:  reporter-feedback
--------------------------+-------------------------------------------------

Comment(by nacin):

 get_post_thumbnail_id() is in a file (post-thumbnail-template.php) that is
 conditionally loaded, assuming the theme supports thumbnails. This
 requires {{{add_theme_support('post-thumbnails')}}} to be called on the
 after_setup_theme hook (or no hook), not init, which is too late for
 require_if_theme_supports().

 Thus, whenever we call one of those functions, we first have to check for
 current_theme_supports. We do that on line 1284.

 It's kind of confusing, and not entirely necessary to conditionally load
 these functions (we could simply have done {{{if ( !
 current_theme_supports('post-thumbnails') ) return false;}}}) but it was
 designed with forward-thinking and scalability in mind.

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


More information about the wp-trac mailing list