The cache will be created automatically after the contents are saved. More Info
true); if(get_option("WpFastestCache_autocache")){ update_option("WpFastestCache_autocache", sanitize_text_field($_POST["is_enable"])); }else{ add_option("WpFastestCache_autocache", sanitize_text_field($_POST["is_enable"]), null, "yes"); } wp_send_json($res); } wp_die("Must be admin"); } public static function set_id($id) { $id = (int)$id; if(get_post_status($id) === "publish"){ self::$id = $id; } } public static function create_cache_for_all_urls(){ if(preg_match("/include\s*\(\s*[\'\"]\/themes\//i", wp_debug_backtrace_summary())){ return array("success" => false, "error_message" => "You cannot call this function in any theme file"); } if(empty(self::$urls)){ return false; } $res_arr = array(); foreach (self::$urls as $url) { $res = $GLOBALS["wp_fastest_cache"]->wpfc_remote_get($url["url"], $url["user-agent"]); array_push($res_arr, array("url" => $url["url"], "success" => $res)); } return $res_arr; } public static function create_cache(){ $res = $GLOBALS["wp_fastest_cache"]->wpfc_remote_get($_GET["url"], $_GET["user_agent"]); if($res){ die("true"); } } public static function is_mobile_active(){ if(isset($GLOBALS["wp_fastest_cache_options"]->wpFastestCacheMobile) && isset($GLOBALS["wp_fastest_cache_options"]->wpFastestCacheMobileTheme)){ return true; }else{ return false; } } public static function set_term_urls($term_taxonomy_id){ $term = get_term_by("term_taxonomy_id", $term_taxonomy_id); if($term && !is_wp_error($term)){ $url = get_term_link($term->term_id, $term->taxonomy); array_push(static::$urls, array("url" => $url, "user-agent" => "WP Fastest Cache Preload Bot")); if(self::is_mobile_active()){ array_push(static::$urls, array("url" => $url, "user-agent" => "WP Fastest Cache Preload iPhone Mobile Bot")); } if($term->parent > 0){ $parent = get_term_by("id", $term->parent, $term->taxonomy); static::set_term_urls($parent->term_taxonomy_id); } } } public static function set_urls_with_terms(){ global $wpdb; $terms = $wpdb->get_results("SELECT * FROM `".$wpdb->prefix."term_relationships` WHERE `object_id`=".static::$id, ARRAY_A); foreach ($terms as $term_key => $term_val){ static::set_term_urls($term_val["term_taxonomy_id"]); } } public static function set_urls(){ if(static::$id){ $permalink = get_permalink(static::$id); array_push(static::$urls, array("url" => $permalink, "user-agent" => "WP Fastest Cache Preload Bot")); if(self::is_mobile_active()){ array_push(static::$urls, array("url" => $permalink, "user-agent" => "WP Fastest Cache Preload iPhone Mobile Bot")); } } } public static function put_inline_js(){ if($data = get_option("WpFastestCache_autocache")){ if($data == "no"){ return false; } }else{ return false; } ?>