Slow wp_enqueue_media()

To load admin scripts only on your pages, you should use the $hook-parameter:

function enqueue_scripts( $hook )
{
  if( 'my-page' != $hook )
    return;

  wp_enqueue_script('jquery');
  wp_enqueue_media();
  // etc...
}
add_action('admin_enqueue_scripts', 'enqueue_scripts');

Concerning the loading problem. This seems to be still an open problem. The ticket 27985 was followed up by #32264, which is not closed yet. The last edit on this was 24hours ago 🙂

Seems like they are searching for a solution and will implement it soon 🙂

Leave a Comment