• Resolved 凱寧

    (@kennyateam990)


    I put these code in functions.php to custom what I need.

    before I add these code,the back_end`s ttfb is 746ms.

    after adding,the ttfb is 3.6s !!!

    speed becomes slow obviously!

    Is there any way to optimize ?

    **//back_end footer text**
    add_filter('admin_footer_text', 'left_admin_footer_text');
    function left_admin_footer_text($text) {
            //left text
            $text = '';
            return $text;}
    add_filter('update_footer', 'right_admin_footer_text', 11);
    function right_admin_footer_text($text) {
            //right text
            $text = "Power by Ateam";
            return $text;}
    
    //Logo
    s URL
    function my_loginURL() {
        return '#';
    }
    add_filter('login_headerurl', 'my_loginURL');
    
    //login page logo text
    function my_loginURLtext() {
        return 'Powered by Ateam';
    }
    add_filter('login_headertitle', 'my_loginURLtext');
    
    //hide the back_end logo
    function annointed_admin_bar_remove() {
            global $wp_admin_bar;
            /* Remove their stuff */
            $wp_admin_bar->remove_menu('wp-logo');
    }
    add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);
    
    //hide the hlep tabs
    add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 );
    function wpse50723_remove_help($old_help, $screen_id, $screen){
    $screen->remove_help_tabs();
    return $old_help;
    }
    
    //stop the update notice (Core)
    remove_action ('load-update-core.php', 'wp_update_themes');
    add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
    
    //stop the update notice(Plugins)
    remove_action( 'load-update-core.php', 'wp_update_plugins' );
    add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
    
    //stop the update notice (Themes)
    remove_action( 'load-update-core.php', 'wp_update_themes' );
    add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
    
    //stop the update (theme)
    add_filter( 'auto_update_theme', '__return_false' );
    
    //stop the update (plugins)
    add_filter( 'auto_update_plugin', '__return_false' );
    
    //stop the back_ends notices
    function pr_disable_admin_notices() {
        global $wp_filter;
          if ( is_user_admin() ) {
            if ( isset( $wp_filter['user_admin_notices'] ) ) {
                    unset( $wp_filter['user_admin_notices'] );
            }
          } elseif ( isset( $wp_filter['admin_notices'] ) ) {
                unset( $wp_filter['admin_notices'] );
          }
          if ( isset( $wp_filter['all_admin_notices'] ) ) {
                unset( $wp_filter['all_admin_notices'] );
          }
      }
    add_action( 'admin_print_scripts', 'pr_disable_admin_notices' );
    • This topic was modified 7 years, 2 months ago by 凱寧.
    • This topic was modified 7 years, 2 months ago by bcworkz. Reason: code fixed
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I don’t see anything in your code that would take very long. I’d say the time difference is due to caching (or the lack thereof) from one of your plugins or your browser, or caching by your host. It could also be due to varying traffic loads on a shared server, DNS delays, or any of the other reasons Internet traffic randomly slows.

Viewing 1 replies (of 1 total)

The topic ‘add code in functions.php will slow down the Execution speed?’ is closed to new replies.