How can I speed up my WP admin section?

We have many WP sites with a proxy in between the servers that they sit on and the internet.

Some things in WP simply don’t work:

  • RSS feeds on dashboard
  • looking up themes
  • looking up plugins
  • core updates

We do everything manually and there are really no issues except for SLOWNESS on page loads. It seems that almost everything in admin take 4-5 seconds to process except for adding media – which is surprisingly fast.

What are some initial things I can check or do to speed up the back-end? (the front-end flies)

3

jQuery / JavaScript in the footer

One thing you can do is to move jQuery to the footer blog post. It’s per default not needed in the header. You will have check if everything still works tough, as I normally just do that for themes:

<?php
/* Plugin Name: Move jQuery to the footer */
function( 'admin_enqueue_scripts', function( $hook )
{
    $GLOBALS['wp_scripts']->add_data( 'jquery', 'group', 1 );
} );

Queries

Another thing that speeds up the post list table screens is to reduce the number of queried fields. I noticed that problem a while ago when those screens were getting loaded too slow due to my 999 posts settings. Full blog post here – Plugin as GitHub Gist.

<?php
/**
 * Plugin Name: (WCM) Faster Admin Post Lists
 * AuthorURL:   http://unserkaiser.com
 * License:     MIT
 */

add_filter( 'posts_fields', 'wcm_limit_post_fields_cb', 0, 2 );
function wcm_limit_post_fields_cb( $fields, $query )
{
  if (
        ! is_admin()
        OR ! $query->is_main_query()
        OR ( defined( 'DOING_AJAX' ) AND DOING_AJAX )
        OR ( defined( 'DOING_CRON' ) AND DOING_CRON )
    )
        return $fields;

    $p = $GLOBALS['wpdb']->posts;
    return implode( ",", array(
        "{$p}.ID",
        "{$p}.post_date",
        "{$p}.post_name",
        "{$p}.post_title",
        "{$p}.ping_status",
        "{$p}.post_author",
        "{$p}.post_password",
        "{$p}.comment_status",
    ) );
}

If you don’t need all columns, you could extend above plugin with removing the contents of some columns as well.

add_filter( 'manage_edit-post_columns', function( $columns )
{
    # @TODO Remove columns which you don't need
    return $defaults;
} );

Dashboard

Every user enters at the dashboard – which is probably the slowest part in the admin UI. You could deactivate some widgets that you don’t need, instead of just hiding them:

<?php
/** Plugin Name: Remove Dashboard Widgets */
add_action( 'wp_dashboard_setup', function()
{
    remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_browser_nag', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
} );

Outgoing data

I can just recommend using Snitch by Sergej Müller to monitor what data tries to leave your installation. The plugin allows to suppress all or just specific connections as well as pin point specific internal connections that target tasks like unwanted cron jobs and similar things. You can look at its source for examples if you don’t want the full package. Sergej normally writes very readable code with a generous white space usage.

Leave a Comment