post_type, 'nav_menu_item') === 0) { RL21UtilWP::onPostChange(RL21UtilWP::POST_ID_ALL); } else { RL21UtilWP::onPostChange($post_ID); } }, 10, 3); add_action('wp_insert_post', function ($post_ID, $post, $update) { RL21UtilWP::onPostChange($post_ID); }, 10, 3); add_action('draft_to_publish', function ($post) { if (!empty($post)) { RL21UtilWP::onPostChange($post->ID); } }, 10, 1); add_action('pending_to_publish', function ($post) { if (!empty($post)) { RL21UtilWP::onPostChange($post->ID); } }, 10, 1); add_action('transition_post_status', function ($new_status, $old_status, $post) { //No need to purge if the post was not public before and its not even now if ('publish' !== $old_status && 'publish' !== $new_status) { return; } RL21UtilWP::onPostChange($post->ID); }, 10, 3); add_action('transition_comment_status', function ($new_status, $old_status, $comment) { RL21UtilWP::onPostChange($comment->comment_post_ID); }, 10, 3); add_action('comment_post', function ($comment_ID, $comment_approved, $commentdata) { if ($comment_approved == 1) { $comment = get_comment($comment_ID); RL21UtilWP::onPostChange($comment->comment_post_ID); } }, 10, 3); add_action('switch_theme', function () { RL21UtilWP::onPostChange('all'); }, 10, 0); add_action('woocommerce_updated_product_stock', function ($product_id) { RL21UtilWP::onPostChange($product_id); }, 10, 1); add_action('woocommerce_updated_product_price', function ($product_id) { RL21UtilWP::onPostChange($product_id); }, 10, 1); add_action('woocommerce_rest_insert_product', function ($post, $request, $creating) { RL21UtilWP::onPostChange($post->ID); }, 10, 3); add_action('woocommerce_rest_insert_product_object', function ($product, $request, $creating) { RL21UtilWP::onPostChange($product->id); }, 10, 3); add_action('woocommerce_product_object_updated_props', function ($product, $updated) { RL21UtilWP::onPostChange($product->get_id()); }, 0, 2); register_shutdown_function(function () { RL21UtilWP::execute_purge($count); }); register_activation_hook(__FILE__, function () { add_option('rabbitloader_do_activation_redirect', true); }); add_action('admin_enqueue_scripts', function() { if ( isset($_GET['page']) && $_GET['page'] === 'rabbitloader' ) { wp_dequeue_script('wp-commands'); wp_dequeue_script('wp-core-commands'); } }, 100); add_action('admin_init', 'rabbitloader_activation_redirect'); function rabbitloader_activation_redirect() { // Only redirect if our flag is set if (!get_option('rabbitloader_do_activation_redirect')) { return; } // Delete the flag so it happens only once delete_option('rabbitloader_do_activation_redirect'); // Prevent redirect on bulk activation if (isset($_GET['activate-multi'])) { return; } // Redirect to your plugin page wp_safe_redirect( admin_url('admin.php?page=rabbitloader') ); exit; } if (is_admin()) { register_activation_hook(__FILE__, 'RabbitLoader_21_Admin::activate_advanced_cache'); register_deactivation_hook(__FILE__, 'RabbitLoader_21_Admin::plugin_deactivate'); register_uninstall_hook(__FILE__, 'RabbitLoader_21_Admin::plugin_uninstall'); add_filter('plugin_action_links_rabbit-loader/rabbit-loader.php', 'RabbitLoader_21_Admin::settings_link'); if (!defined('RABBITLOADER_UNINSTALL_MODE')) { RabbitLoader_21_Admin::addActions(); } } else { if (!defined('RABBITLOADER_AC_ACTIVE')) { //advance cache failed to work, as a fallback we can intercept requests here RabbitLoader_21_Public::process_incoming_request('fallback'); } RabbitLoader_21_Public::addActions(); } if (defined("WP_CLI") && WP_CLI) { include_once($plug_dir . 'wp-cli.php'); }