WP-Optimize 4.7.1 has 50 actions and 151 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when WP-Optimize fires an action
add_action( 'wpo_cache_flush', function() {
// Your code runs here.
}, 10, 1 );
// Change a value WP-Optimize is about to use
add_filter( 'wpo_cache_show_cached_by_comment', function( $value ) {
// Change $value here.
return $value;
}, 10, 1 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
wpo_cache_flush
action/** * Fires after purging the cache */ do_action( 'wpo_cache_flush' ); -
/** * Filter whether to display the html comment <!-- Cached by WP-Optimize ... * --> */ apply_filters( 'wpo_cache_show_cached_by_comment', true ); -
wpo_get_mapped_domain
filter/** * Filters the mapped domain name */ apply_filters( 'wpo_get_mapped_domain', $domain, $blog_id ); -
/** * Filters if Multisite Domain mapping is enabled. Currently, we can only * detect if the WordPress MU Domain Mapping plugin is in use. Using the WP * Core functionality should not require this, unless if the domain name is set * somewhere else but in the site url option. */ apply_filters( 'wpo_is_domain_mapping_enabled', $enabled ); -
wpo_minify_stylesheets
filter/** * Filters the array of stylesheets before processing them */ apply_filters( 'wpo_minify_stylesheets', $header, 'header' ); -
/** * Filters the commands allowed to the sub site admins. Other commands are only * available to network admin. Only used in a multisite context. */ apply_filters( 'wpo_multisite_allowed_commands', array('check_server_status', 'compress_single_image', 'restore_single_image') ); -
wpo_preload_get_site_urls
filter/** * Filter the URLs which will be preloaded */ apply_filters( 'wpo_preload_get_site_urls', $urls ); -
pre_unschedule_hook
filter/** * Filter to preflight or hijack clearing all events attached to the hook. */ apply_filters( 'pre_unschedule_hook', null, $hook ); -
/** * Minify cache lifespan */ apply_filters( 'wp_optimize_minify_cache_expiry_time', time() - 86400 * $cache_lifespan ); -
wp-optimize-minify-blacklist
filter/** * Filters the default IE specific / blacklisted items */ apply_filters( 'wp-optimize-minify-blacklist', $default_ie_blacklist ); -
/** * Filters the default exclusions */ apply_filters( 'wp-optimize-minify-default-exclusions', $default_exclusions ); -
/** * Filters the interval between each preload attempt, in seconds. */ apply_filters( "wpo_{$this->preload_type}_preload_continue_interval", 600 ); -
/** * Filters the minimum memory required before stopping a queue. Default: 10MB */ apply_filters( "wpo_{$this->preload_type}_preload_memory_threshold", 10485760 ); -
/** * Action executed when an active theme or plugin was updated */ do_action( 'wpo_active_plugin_or_theme_updated' ); -
/** * Filters whether to add a cookie when a comment is posted, in order to * exclude the page from caching. Regular comments have the property * comment_type set to '' or 'comment'. So by default, only add the cookie in * those cases. */ apply_filters( 'wpo_add_commented_post_cookie', '' === $comment->comment_type || 'comment' === $comment->comment_type, $comment ); -
/** * Filters if a cache should systematically be regenerated when running a * manual preload. Default: false */ apply_filters( 'wpo_always_regenerate_file_if_preload_is_manual', false ); -
/** * Filters if a cache should systematically be regenerated when running a * scheduled preload. Default: false */ apply_filters( 'wpo_always_regenerate_file_if_preload_is_scheduled', false ); -
wpo_cache_cookies
filter/** * Filters the cookies used to set cache file names */ apply_filters( 'wpo_cache_cookies', array(), $config ); -
wpo_cache_extensions_loaded
action/** * Action triggered when the cache extensions are all loaded. Allows to execute * code depending on an other extension, without knowing the order in which the * files are loaded. */ do_action( 'wpo_cache_extensions_loaded' ); -
/** * Filter the sitemap file used to collect the URLs to preload */ apply_filters( 'wpo_cache_preload_sitemap_filename', $sitemap_filename ); -
wpo_cache_query_variables
filter/** * Filters the query variables used to set cache file names */ apply_filters( 'wpo_cache_query_variables', array(), $config ); -
wpo_can_cache_page
filter/** * Defines if the page can be cached or not */ apply_filters( 'wpo_can_cache_page', $can_cache_page ); -
/** * Filters the options for a single image to compress. Currently, supports: - * 'quality': Will use the image quality set in this filter, instead of the one * defined in the settings. */ apply_filters( 'wpo_image_compression_single_image_options', array(), $attachment_id, $file_path, $size ); -
wpo_is_kinsta_server
filter/** * Filter whether the server is detected as Kinsta. */ apply_filters( 'wpo_is_kinsta_server', $is_kinsta ); -
/** * Expiry threshold: the current file will be considered stale if within the * threshold. Default: 600s (10min) */ apply_filters( 'wpo_lifespan_expiry_threshold', 600 ); -
wpo_min_after_purge_others
action/** * Action triggered when purging other plugins cache, and nothing was triggered */ do_action( 'wpo_min_after_purge_others' ); -
/** * Action triggered after purging temporary files */ do_action( 'wpo_min_after_purge_temp_files' ); -
wpo_min_before_purge_others
action/** * Action triggered before purging other plugins cache */ do_action( 'wpo_min_before_purge_others' ); -
/** * Filters the result of always_purge_everything */ apply_filters( 'wpo_minify_always_purge_everything', 0 === intval($this->get('cache_lifespan')) || (defined('WPO_ADVANCED_CACHE') && defined('WP_CACHE') && WP_CACHE) ); -
wpo_minify_defer_or_async
filter/** * Filters whether to use the defer attribute or async. */ apply_filters( 'wpo_minify_defer_or_async', 'defer', $tag, $handle, $src ); -
/** * Filters the arguments passed to wp_remote_get when downloading the scripts. */ apply_filters( 'wpo_minify_download_request_args', $args, $url ); -
wpo_minify_exclude_contents
filter/** * Whether to exclude the content or not from the minifying process. */ apply_filters( 'wpo_minify_exclude_contents', false ); -
wpo_minify_get_css
filter/** * Filters the imported CSS */ apply_filters( 'wpo_minify_get_css', $css, $url, $enable_css_minification ); -
wpo_minify_get_js
filter/** * Filters the imported JavaScript */ apply_filters( 'wpo_minify_get_js', $js . "\n", $url, $enable_js_minification ); -
/** * Filters whether to add display=swap to Google fonts urls */ apply_filters( 'wpo_minify_gfont_display_swap', $config->get('enable_display_swap') ); -
/** * Filters the value of the display parameter. */ apply_filters( 'wpo_minify_gfont_display_type', 'swap' ); -
/** * Filters whether to ignore the order of the CSS files, and group them by * media type */ apply_filters( 'wpo_minify_maintain_css_order', true ); -
wpo_minify_run_on_page
filter/** * Filters whether the functionality is run on the current page. */ apply_filters( 'wpo_minify_run_on_page', !is_admin() && (!defined('SCRIPT_DEBUG') || !SCRIPT_DEBUG) && !is_preview() && (!function_exists('is_customize_preview') || !is_customize_preview()) && !($this->options['disable_when_logged_in'] && is_user_logged_in()) && !(function_exists('is_amp_endpoint') && is_amp_endpoint()) && !WP_Optimize_Minify_Functions::exclude_contents(), $context ); -
wpo_minify_settings_tabs
action/** * Called before outputting the submit button in the setting fields in Minify > * Advanced */ do_action( 'wpo_minify_settings_tabs', $wpo_minify_options ); -
/** * Purge the whole cache if set to true, only the edited post otherwise. * Default is false. */ apply_filters( 'wpo_purge_all_cache_on_update', false, $post_id ); -
/** * Filters whether activating / deactivating a plugin will purge the cache. */ apply_filters( 'wpo_purge_page_cache_on_activate_deactivate_plugin', true ); -
/** * Filters if a cache should systematically be regenerated when running a * preload and no schedule is set, and cache does not expire. Default: true */ apply_filters( 'wpo_regenerate_file_when_no_expiry_date', true ); -
wpo_save_minify_settings
filter/** * Filters the data before saving it */ apply_filters( 'wpo_save_minify_settings', $new_data ); -
/** * Filters whether data should be included in certain templates or not. */ apply_filters( 'wpo_template_should_include_data', $this->is_updraft_central_request() ); -
/** * Action triggered after preloading a single url */ do_action( 'wpoptimize_after_minify_preload_url', $url, $minify_preloader ); -
wpoptimize_after_preload_url
action/** * Action triggered after preloading a single url */ do_action( 'wpoptimize_after_preload_url', $url, $cache_preloader ); -
/** * Filters wp_remote_get parameters, when checking if browser cache is enabled. */ apply_filters( 'wpoptimize_get_stylesheet_headers_args', array('timeout' => 10) ); -
/** * Allows to change the delay between each URL preload, to reduce server load. */ apply_filters( 'wpoptimize_minify_preload_delay', 500000 ); -
wpoptimize_preload_delay
filter/** * Allows to change the delay between each URL preload, to reduce server load. */ apply_filters( 'wpoptimize_preload_delay', 500000 ); -
wpo_delete_cache_by_url
actiondo_action( 'wpo_delete_cache_by_url', $url, $recursive ); -
wpo_preload_headers
filterapply_filters( 'wpo_preload_headers', array() ); -
wpo_preload_url
actiondo_action( 'wpo_preload_url', $url ); -
do_action( 'wp_optimize_after_optimizations' ); -
do_action( 'wp_optimize_register_admin_content' ); -
wp_optimize_skip_inlining
filterapply_filters( 'wp_optimize_skip_inlining', false === $file_size || $file_size > 20480, $file_size, $href ); -
wpo_allow_cache_gzip_files
filterapply_filters( 'wpo_allow_cache_gzip_files', true ); -
wpo_cron_next_event
filterapply_filters( 'wpo_cron_next_event', $next_optimization_timestamp ); -
apply_filters( 'wpo_get_uncompressed_images_args', $args ); -
apply_filters( 'wpo_page_cache_schedule_preload_use_nighttime', 1 ); -
wpo_page_not_cached
actiondo_action( 'wpo_page_not_cached', $no_cache_because ); -
wpo_run_button_caption
filterapply_filters( 'wpo_run_button_caption', __('Optimize all', 'wp-optimize') ); -
wpo_save_images_settings
actiondo_action( 'wpo_save_images_settings' ); -
wpo_serve_cache_via_htaccess
filterapply_filters( 'wpo_serve_cache_via_htaccess', false ); -
wpo_should_preload_amp
filterapply_filters( 'wpo_should_preload_amp', false, $url ); -
allowed_task_stages
filterapply_filters( 'allowed_task_stages', $stages ); -
auto_option_settings
actiondo_action( 'auto_option_settings', $settings ); -
do_action( 'autoptimize_action_cachepurged' ); -
ce_clear_cache
actiondo_action( 'ce_clear_cache' ); -
get_optimization_blogs
filterapply_filters( 'get_optimization_blogs', $objects ); -
apply_filters( 'mark_all_as_uncompressed_images_per_request', 100 ); -
show_cloudflare_settings
filterapply_filters( 'show_cloudflare_settings', $is_cloudflare_site ); -
ud_smush_task_failed
actiondo_action( 'ud_smush_task_failed', $this, $error_code, $error_message ); -
ud_task_initialised
actiondo_action( 'ud_task_initialised', $this ); -
ud_task_started
actiondo_action( 'ud_task_started', $this ); -
apply_filters( 'updraft_smush_js_translations', array( 'all_images_compressed' => __('No uncompressed images were found.', 'wp-optimize'), 'error_unexpected_response' => __('An unexpected response was received from the server.', 'wp-optimize') . ' ' . __('More information has been logged in the browser console.', 'wp-optimize'), 'compress_single_image_dialog' => __('Please wait: compressing the selected image.', 'wp-optimize'), 'error_try_ag... ); -
updraft_smush_posts_per_page
filterapply_filters( 'updraft_smush_posts_per_page', 1000 ); -
apply_filters( 'updraftcentral_command_base_class_at', UPDRAFTPLUS_DIR.'/central/commands.php' ); -
apply_filters( "wp_optimize_admin_{$page}_default_tab", $tab_keys[0] ); -
do_action( "wp_optimize_admin_after_page_{$page}", $active_tab ); -
do_action( "wp_optimize_admin_page_{$page}", $active_tab ); -
do_action( "wp_optimize_admin_page_{$page}_{$tab_id}" ); -
apply_filters( "wp_optimize_admin_page_{$page}_tabs", $tabs ); -
do_action( "wp_optimize_admin_page_{$section}_{$tab_id}" ); -
do_action( 'wp_optimize_after_optimization', $which_optimization, $optimization ); -
wp_optimize_after_template
actiondo_action( 'wp_optimize_after_template', $path, $template_file, $return_instead_of_echo, $extract_these ); -
wp_optimize_before_template
actiondo_action( 'wp_optimize_before_template', $path, $template_file, $return_instead_of_echo, $extract_these ); -
wp_optimize_buffer
filterapply_filters( 'wp_optimize_buffer', $buffer, $flags ); -
apply_filters( 'wp_optimize_capability_required', $capability ); -
wp_optimize_db_update_hooks
filterapply_filters( 'wp_optimize_db_update_hooks', $import_done_hooks ); -
wp_optimize_do_optimization
filterapply_filters( 'wp_optimize_do_optimization', true, $which_optimization, $optimization ); -
apply_filters( 'wp_optimize_get_optimizations', $optimization_objects ); -
apply_filters( 'wp_optimize_get_optimizations_list', $optimizations ); -
wp_optimize_get_table
filterapply_filters( 'wp_optimize_get_table', $table ); -
wp_optimize_get_table_prefix
filterapply_filters( 'wp_optimize_get_table_prefix', $prefix ); -
wp_optimize_get_tables
filterapply_filters( 'wp_optimize_get_tables', $table_status ); -
apply_filters( 'wp_optimize_get_tables_include_table', $include_table, $table_name, $table_prefix ); -
wp_optimize_heartbeat_ajax
filterapply_filters( 'wp_optimize_heartbeat_ajax', $command ); -
apply_filters( 'wp_optimize_is_backup_plugin_installed', false ); -
apply_filters( 'wp_optimize_is_heartbeat_valid_ajax_command', $command ); -
wp_optimize_loggers
filterapply_filters( 'wp_optimize_loggers', $loggers ); -
wp_optimize_loggers_classes
filterapply_filters( 'wp_optimize_loggers_classes', $loggers_classes ); -
apply_filters( 'wp_optimize_optimization_class', 'WP_Optimization_'.$which_optimization ); -
apply_filters( 'wp_optimize_optimization_class_file', $optimization_file ); -
do_action( 'wp_optimize_optimization_query', $sql, $this ); -
apply_filters( 'wp_optimize_optimization_query_result', $result, $sql, $this ); -
apply_filters( 'wp_optimize_optimization_results', $results, $this->id, $this ); -
wp_optimize_option_keys
filterapply_filters( 'wp_optimize_option_keys', $keys ); -
wp_optimize_schedule_types
filterapply_filters( 'wp_optimize_schedule_types', $schedule_types ); -
wp_optimize_template
filterapply_filters( 'wp_optimize_template', $template_file, $path ); -
apply_filters( 'wp_optimize_template_directories', $template_directories ); -
wp_optimize_templates_dir
filterapply_filters( 'wp_optimize_templates_dir', $templates_dir ); -
wp_optimize_templates_url
filterapply_filters( 'wp_optimize_templates_url', $templates_url ); -
apply_filters( "wpo_{$this->preload_type}_preloader_amp_args", $amp_args, $url ); -
apply_filters( "wpo_{$this->preload_type}_preloader_desktop_args", $desktop_args, $url ); -
apply_filters( "wpo_{$this->preload_type}_preloader_dont_close_browser_connection", $this->dont_close_browser_connection ); -
wpo_additional_options
actiondo_action( 'wpo_additional_options' ); -
wpo_admin_after_header
actiondo_action( 'wpo_admin_after_header' ); -
do_action( 'wpo_admin_before_closing_wrap' ); -
do_action( 'wpo_after_cache_conditional_tags' ); -
do_action( 'wpo_after_cache_exception_urls' ); -
do_action( 'wpo_after_cache_exception_urls_fieldgroup' ); -
do_action( 'wpo_after_cache_ignore_query_variables' ); -
do_action( 'wpo_after_cache_ignore_query_variables_fieldgroup' ); -
wpo_after_cache_settings
actiondo_action( 'wpo_after_cache_settings' ); -
wpo_after_general_settings
actiondo_action( 'wpo_after_general_settings' ); -
do_action( 'wpo_after_minify_javascript_options' ); -
apply_filters( 'wpo_allowed_conditional_tags_exceptions', $allowed_functions ); -
do_action( "wpo_before_{$this->preload_type}_preload" ); -
apply_filters( 'wpo_cache_can_output_gzip_content', $wpo_cache_can_output_gzip_content ); -
wpo_cache_config_updated
actiondo_action( 'wpo_cache_config_updated', $config ); -
wpo_cache_defaults
filterapply_filters( 'wpo_cache_defaults', $defaults ); -
wpo_cache_filename
filterapply_filters( 'wpo_cache_filename', $filename ); -
wpo_cache_gzip_level
filterapply_filters( 'wpo_cache_gzip_level', 6 ); -
wpo_cache_modified_time
filterapply_filters( 'wpo_cache_modified_time', $modified_time, $path ); -
wpo_cache_page_force
filterapply_filters( 'wpo_cache_page_force', false ); -
wpo_cache_size_expiration
filterapply_filters( 'wpo_cache_size_expiration', DAY_IN_SECONDS ); -
apply_filters( 'wpo_cache_size_files_to_ignore', $this->files_to_ignore ); -
wpo_cache_update_config
filterapply_filters( 'wpo_cache_update_config', $config ); -
wpo_converters_with_shell
filterapply_filters( 'wpo_converters_with_shell', $converters_with_shell ); -
wpo_converters_without_shell
filterapply_filters( 'wpo_converters_without_shell', $converters_without_shell ); -
wpo_default_auto_options
filterapply_filters( 'wpo_default_auto_options', $new_auto_options ); -
apply_filters( 'wpo_delete_cached_homepage_on_post_update', true, $post_id ); -
wpo_disable_webp_alter_html
filterapply_filters( 'wpo_disable_webp_alter_html', false ); -
wpo_dont_smush_sizes
filterapply_filters( 'wpo_dont_smush_sizes', array() ); -
wpo_faq_url
filterapply_filters( 'wpo_faq_url', 'https://teamupdraft.com/documentation/wp-optimize/topics/database-optimization/faqs/' ); -
wpo_feeds_caching_enabled
filterapply_filters( 'wpo_feeds_caching_enabled', true ); -
apply_filters( 'wpo_force_webp_serve_using_altered_html', false ); -
wpo_get_cache_include_urls
filterapply_filters( 'wpo_get_cache_include_urls', $cache_include_urls ); -
wpo_get_cache_purge_params
filterapply_filters( 'wpo_get_cache_purge_params', $original_purge_params ); -
apply_filters( 'wpo_get_plugin_json_file_path', trailingslashit($uploads_dir['basedir']).'wpo/wpo-plugins-tables-list.json' ); -
wpo_get_tables_data
filterapply_filters( 'wpo_get_tables_data', $tables_data ); -
wpo_get_url_exceptions
filterapply_filters( 'wpo_get_url_exceptions', $exceptions ); -
apply_filters( 'wpo_image_compressed_by_another_plugin', false ); -
apply_filters( 'wpo_image_compression_accepted_mime_types', array('image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/webp') ); -
wpo_js_translations
filterapply_filters( 'wpo_js_translations', $translations ); -
wpo_kses_allowed_attrs
filterapply_filters( 'wpo_kses_allowed_attrs', self::$allowed_attrs ); -
wpo_load_compatibilities
actiondo_action( 'wpo_load_compatibilities' ); -
wpo_max_file_size
filterapply_filters( 'wpo_max_file_size', 600000 ); -
wpo_maybe_clear_files_list
filterapply_filters( 'wpo_maybe_clear_files_list', $files ); -
apply_filters( 'wpo_minfy_remove_print_mediatypes_import', true, $url, $media_query, $matches[0], $file_url ); -
wpo_minify_css_string
filterapply_filters( 'wpo_minify_css_string', $css ); -
wpo_minify_defaults
filterapply_filters( 'wpo_minify_defaults', $defaults ); -
apply_filters( 'wpo_minify_file_modification_time', $modification_time, $abs_file_path ); -
apply_filters( 'wpo_minify_found_incompatible_plugins', $found_incompatible_plugins ); -
wpo_minify_inline_css
filterapply_filters( 'wpo_minify_inline_css', true ); -
wpo_minify_inline_js
filterapply_filters( 'wpo_minify_inline_js', true ); -
wpo_minify_inline_js_string
filterapply_filters( 'wpo_minify_inline_js_string', $js ); -
wpo_minify_js_string
filterapply_filters( 'wpo_minify_js_string', $js ); -
apply_filters( 'wpo_minify_status_show_files_on_load', true ); -
wpo_option_key_{$option_key}
filterapply_filters( "wpo_option_key_{$option_key}", ($options[$option_key] ?? $default) ); -
do_action( 'wpo_page_cache_advanced_settings', $wpo_cache_options ); -
wpo_page_cache_disabled
actiondo_action( 'wpo_page_cache_disabled' ); -
apply_filters( 'wpo_page_cache_preloader_amp_args', $amp_args, $url ); -
apply_filters( 'wpo_page_cache_preloader_mobile_args', $mobile_args, $url ); -
do_action( 'wpo_page_cache_settings_after', $wpo_cache_options ); -
wpo_pre_cache_buffer
filterapply_filters( 'wpo_pre_cache_buffer', $buffer, $flags ); -
apply_filters( 'wpo_preload_allowed_time_difference', $time_limit ); -
apply_filters( 'wpo_preloader_should_regenerate_file', $result, $path, $preload_type ); -
wpo_purge_cache_hooks
filterapply_filters( 'wpo_purge_cache_hooks', $actions ); -
apply_filters( 'wpo_restricted_cache_page_type', false ); -
apply_filters( 'wpo_save_cache_settings_validation', $data['cache-settings'] ); -
do_action( 'wpo_single_post_cache_deleted', $post_id ); -
do_action( 'wpo_single_post_feed_cache_deleted', $post_id ); -
apply_filters( 'wpo_tables_list_additional_column_data', '', $tablestatus ); -
wpo_tables_list_before
actiondo_action( 'wpo_tables_list_before' ); -
wpo_update_plugin_json
filterapply_filters( 'wpo_update_plugin_json', true ); -
wpo_uploads_sub_folders
filterapply_filters( 'wpo_uploads_sub_folders', $sub_folders ); -
apply_filters( 'wpo_url_in_conditional_tags_exceptions', false ); -
wpo_user_agent
filterapply_filters( 'wpo_user_agent', $user_agent, $type ); -
apply_filters( 'wpo_write_server_info_in_smush_log', false ); -
wpoptimize_admin_node_title
filterapply_filters( 'wpoptimize_admin_node_title', 'WP-Optimize' ); -
wpoptimize_com_link
filterapply_filters( 'wpoptimize_com_link', "https://teamupdraft.com/blog/the-scheduler-in-wordpress-is-not-working-what-should-i-do/" ); -
apply_filters( 'wpoptimize_maybe_add_affiliate_params', $url ); -
apply_filters( 'wpoptimize_updraftplus_com_link', $url );
Generated from WP-Optimize's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Can't find the right hook?
We can build the customisation for you. Describe what you need: