SHARE
TWEET

Preload/Clear pages

a guest Feb 27th, 2020 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // Load WordPress.
  4. require( 'wp-load.php' );
  5.  
  6. // Add one page/post per line
  7. $pages_to_clean_preload =   [
  8.                             'https://example.com/page_url',//copy this line as many times as necessary, adding the URLs you want to clear/preload
  9.                             ];
  10.  
  11. if ( function_exists( 'rocket_clean_post' ) ) {
  12.  
  13.     foreach( $pages_to_clean_preload as $page_to_clean){
  14.         rocket_clean_post( url_to_postid ( $page_to_clean ) );
  15.     }
  16. }
  17.  
  18. // Preload pages/posts
  19. foreach( $pages_to_clean_preload as $page_to_preload){
  20.         wp_remote_get( $page_to_preload );
  21.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top