WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#25590 closed defect (bug) (worksforme)

multisite add/insert media dialoge – no pictures

Reported by: francishunger Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6.1
Component: Media Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

After updating from 3.4 MU to 3.6 MU the following problem appears: In the "add /insert media" dialogue, the images are not shown. When I upload images, the upload through drag & drop obviously works, since I can see the images in the media library later on. But I can't see the images in the "add media" dialogue at all, altough they are connected to a certain article in media library. (I'm talking about: within the same network sub-site)

  • flushed cache
  • deactivated all plugins
  • reinstalled version 3.6
  • only appears on my MU site, both on the primary and secondary blog
  • deactivating .htacess did not change anything
  • WP debug: true throws:
    PHP Notice: is_feed was called <strong>incorrectly</strong>. Conditional query tags do not work before the query is run. Before then, they always return false. Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.1.) in /homepages/43/d175858298/htdocs/wp-includes/functions.php on line 3041
    

It seems, the files get not loaded, since in the HTML only appears one line:

<ul class="attachments ui-sortable ui-sortable-disabled" id="__attachments-view-54"></ul>

Change History (6)

#1 @SergeyBiryukov
6 years ago

  • Description modified (diff)

WP debug: true throws:

PHP Notice: is_feed was called <strong>incorrectly</strong>. Conditional query tags do not work before the query is run. Before then, they always return false. Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.1.) in /homepages/43/d175858298/htdocs/wp-includes/functions.php on line 3041

You should get rid of that notice to rule it out as a possible cause. If it still appears after deactivating all plugins, try switching to a default theme (Twenty Thirteen or Twenty Twelve).

#2 follow-up: @francishunger
6 years ago

Thanks, Sergey

Although I was tempted to say "I did all that", I did it again and voila: Turns out the problem was in my theme (but had nothing to do with the PHP notice). Some more testing pointed to my functions.php where I had the following function to remove parts of the backend navigation.

/*–––––––  REMOVE BACKEND NAVI –––––––*/
add_action( 'admin_init', 'smu_remove_menu_pages' );
 
function smu_remove_menu_pages() {
    remove_menu_page('edit.php');                   // Removes menu 'articles'
    remove_menu_page('link-manager.php');           // Removes menu 'links'
    remove_menu_page('edit-comments.php');          // Removes menu 'comments'
}

However, it is not any of the individual lines but the complete function that disturbed the add media dialog. Strangely enough this disturbance didn't occour in WP MU 3.4, so there might have been changes of which I'm unaware that contradict this approach to remove menu-points from the left admin menu bar. For the time-being I think I'll turn to some of the ready made tools like 'adminize' I guess.

#3 @francishunger
6 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

#4 @markoheijnen
6 years ago

  • Milestone Awaiting Review deleted

Clearing out the milestones for closed tickets on Awaiting Review

This ticket was mentioned in IRC in #wordpress-dev by sterlo. View the logs.


6 years ago

#6 in reply to: ↑ 2 @SergeyBiryukov
6 years ago

Replying to francishunger:

However, it is not any of the individual lines but the complete function that disturbed the add media dialog.

To clarify, it's not remove_menu_page() by itself, it's the warning that breaks the AJAX request:

Warning: Invalid argument supplied for foreach() in wp-admin/includes/plugin.php on line 1375

See tags/3.8.3/src/wp-admin/includes/plugin.php#L1375.

You should use admin_menu action rather than admin_init (since admin_init also fires during AJAX requests).

Note: See TracTickets for help on using tickets.