Aleš Sýkora wrote

Speeding up WordPress & Toolset

7. 11. 2019 in

Hello, I have some speeding up tips for your WordPress & Toolset website. Currently I found that GeneratePress Premium + Toolset + WP Rocket do a really great job.

I can easy go to 0.5sec on 1st load of page on shared webhosting running two WP sites with 1200 posts. It will be even better when the old site will be changed with new currently developed version.

  1. Disable Pagination scripts + CSS (if you do not use pagination) – BE CAREFUL 😉
  2. Remove loading of dashicons in frontend
  3. Remove WordPress RSD link
  4. Remove WordPress Shortlink
  5. Disable XML-RPC
  6. Disable generating of WP version in head
  7. Disable WLW manifest (static file, no speed up)
  8. Disable Pingbacks

Put these into custom code snippet in Toolset settings (do not create a garbage in functions.php):

// Disable Pagination script
function cleanup_scripts() {
 
    if ( !is_admin() ) {
 
        wp_dequeue_script( 'wpv-pagination' );
 
    }
}
add_action( 'wp_print_scripts', 'cleanup_scripts', 100 );

// Disable Pagination CSS
function cleanup_styles() {
 
    if ( !is_admin() ) {
 
        wp_dequeue_style( 'views-pagination-style' );
 
    }
}
add_action( 'wp_print_styles', 'cleanup_styles', 100 );

// Remove dashicons in frontend for unauthenticated users
add_action( 'wp_enqueue_scripts', 'bs_dequeue_dashicons' );
function bs_dequeue_dashicons() {
    if ( ! is_user_logged_in() ) {
        wp_deregister_style( 'dashicons' );
    }
}

// Remove RSD link
remove_action( 'wp_head', 'rsd_link' ) ;

//Remove WordPress shortlink
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);

// Remove XMLRPC
add_filter('xmlrpc_enabled', '__return_false');

// Hide WP version from head
remove_action( 'wp_head', 'wp_generator' ) ;

// Remove WLW manifest
remove_action( 'wp_head', 'wlwmanifest_link' ) ;

// Disable pingbacks
add_action( 'pre_ping', 'disable_pingback' );

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from category
Aleš Sýkora wrote
Multistep form with Toolset Forms and Bootstrap Accordion
19. 9. 2018 in
Need to make long form simple to use? Use the accordion module from bootstrap and Toolset forms. Try it now! We provide you code snippets & easy tutorial.
Read More
Aleš Sýkora wrote
Change WordPress login logo with code
6. 11. 2020 in
Need to change wordpress login logo? Use this code in custom plugin or in Code Snippets plugin. Change the background image url to your image and Link Title to your site name for example.
Read More
Aleš Sýkora wrote
Change WP Rocket lazyload treshold
21. 1. 2021 in
Default treshold for lazyload is 300px in WP-Rocket. That means that images that are within 300px of the viewport (browser window) are loaded for smooth user experience. If you like to load less images – for example 100px after viewport only – you can not set it up directly in WP Rocket’s settings page. To […]
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram