[wp-trac] [WordPress Trac] #19814: add_theme_support() inside init hook function breaks post attachments
WordPress Trac
wp-trac at lists.automattic.com
Mon Feb 13 06:02:04 UTC 2012
#19814: add_theme_support() inside init hook function breaks post attachments
---------------------------+------------------------------
Reporter: jamesmehorter | Owner: James Mehorter
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 3.3.1
Severity: normal | Resolution:
Keywords: needs-patch |
---------------------------+------------------------------
Comment (by SergeyBiryukov):
Calling `add_theme_support( 'post-thumbnails' )` on `init` action and
trying to upload an image on the Edit Post screen results in the error:
{{{
Fatal error: Call to undefined function get_post_thumbnail_id() in wp-
admin/includes/media.php on line 1169
}}}
The reason is that `post-thumbnail-template.php` is required before
`init`:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-settings.php#L291
So `init` is too late to call `add_theme_support( 'post-thumbnails' )`.
That said, both uploading and attaching images to posts seem to work in
current trunk (in spite of the error).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19814#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list