Title: Preload function from standalone php
Last modified: April 18, 2023

---

# Preload function from standalone php

 *  Resolved [Hadis](https://wordpress.org/support/users/hadis89/)
 * (@hadis89)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/preload-function-from-standalone-php/)
 * Hi,
 * is it possible to call preload function from standalone php file? I have following
   script, but it only works from browser where user is logged in to wordpress:
 *     ```wp-block-code
       define( 'WP_USE_THEMES', false );
       include_once 'wp-load.php';
   
   
       WP_Optimize_Page_Cache_Preloader::instance()->run('manual');
       ```
   
 * If it called from cronjob (this is what I want) it just preload 20 – 25 pages
   and stops.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Venkat Raj](https://wordpress.org/support/users/webulous/)
 * (@webulous)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/preload-function-from-standalone-php/#post-16668048)
 * [@hadis89](https://wordpress.org/support/users/hadis89/) 
   1. Since this is privileged
   task, only logged in users can run preload. 2. This is long running task for 
   huge sites. So, it creates sub tasks for each URL and schedule it to run via 
   cron job (WP Cron). At max_execution_time it is possible that it loaded ~25 pages
   and stops (but creates cron job to run later, to avoid max. load on server at
   one stretch)3. `process_tasks_queue` method will run on `wpo_page_cache_preload_continue`
   hook
 *  Thread Starter [Hadis](https://wordpress.org/support/users/hadis89/)
 * (@hadis89)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/preload-function-from-standalone-php/#post-16668114)
 * Thanks for ansswer

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Preload function from standalone php’ is closed to new replies.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Hadis](https://wordpress.org/support/users/hadis89/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/preload-function-from-standalone-php/#post-16668114)
 * Status: resolved