[wp-trac] [WordPress Trac] #28219: add_media 'Uploaded to this post' listing unattached files when post type does not support 'thumbnail'

WordPress Trac noreply at wordpress.org
Mon May 12 17:01:28 UTC 2014


#28219: add_media 'Uploaded to this post' listing unattached files when post type
does not support 'thumbnail'
--------------------------+------------------------------
 Reporter:  bobbingwide   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  3.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration
--------------------------+------------------------------

Comment (by bobbingwide):

 I have traced this problem further. It would appear that the
 wp_enqueue_media() function is being called multiple times by different
 actions.

 With WordPress SEO it first gets invoked by 'admin_enqueue_scripts'

 {{{
 0. bw_lazy_backtrace C:\apache\htdocs\wp-
 content\plugins\oik\bwtrace.inc:59 0
 1. bw_backtrace C:\apache\htdocs\wp-includes\media.php:2660 0
 2. wp_enqueue_media C:\apache\htdocs\wp-content\plugins\wordpress-
 seo\admin\class-metabox.php:712 0
 3. enqueue(post.php) C:\apache\htdocs\wp-content\plugins\wordpress-
 seo\admin\class-metabox.php:0 1
 4. call_user_func_array(Array,Array) C:\apache\htdocs\wp-
 includes\plugin.php:470 2
 5. do_action(admin_enqueue_scripts,post.php) C:\apache\htdocs\wp-admin
 \admin-header.php:80 2
 6. require_once(C:\apache\htdocs\wp-admin\admin-header.php)
 C:\apache\htdocs\wp-admin\edit-form-advanced.php:365 1
 7. include(C:\apache\htdocs\wp-admin\edit-form-advanced.php)
 C:\apache\htdocs\wp-admin\post.php:211 1
 }}}

 but the post information is not passed until 'media_buttons'

 {{{
 0. bw_lazy_backtrace C:\apache\htdocs\wp-
 content\plugins\oik\bwtrace.inc:59 0
 1. bw_backtrace C:\apache\htdocs\wp-includes\media.php:2660 0
 2. wp_enqueue_media(Array) C:\apache\htdocs\wp-
 admin\includes\media.php:523 1
 3. media_buttons(content) C:\apache\htdocs\wp-admin\includes\media.php:0 1
 4. call_user_func_array(media_buttons,Array) C:\apache\htdocs\wp-
 includes\plugin.php:470 2
 5. do_action(media_buttons,content) C:\apache\htdocs\wp-includes\class-wp-
 editor.php:205 2
 6. editor(,content,Array) C:\apache\htdocs\wp-includes\general-
 template.php:2284 3
 7. wp_editor(,content,Array) C:\apache\htdocs\wp-admin\edit-form-
 advanced.php:497 3
 8. include(C:\apache\htdocs\wp-admin\edit-form-advanced.php)
 C:\apache\htdocs\wp-admin\post.php:211 1
 }}}

 with wp_enqueue_media() there is a test to see if 'wp_enqueue_media' has
 already been invoked.
 In the second invocation control is returned so the post information is
 not included,
 which leads to the problem reported.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28219#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list