Advertisement
artemsemkin

Disable preloader on certain posts/pages

Oct 11th, 2021 (edited)
872
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter( 'theme_mod_preloader_enabled', function( $value ) {
  4.   // Ex 1: don't show preloader on specific post with ID 1164
  5.   if ( is_single( '1164' ) ) {
  6.     $value = false;
  7.   }
  8.  
  9.   // Ex 2: don't show preloader on specific page with ID 1355
  10.   if ( is_page( '1355' ) ) {
  11.     $value = false;
  12.   }
  13.  
  14.   // Ex 3: don't show preloader on Elementor pages with disabled "TO" AJAX route
  15.   if ( in_array( 'page-no-ajax', get_body_class() ) ) {
  16.     $value = false;
  17.   }
  18.  
  19.   return $value;
  20. });
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement