List of pre_get_rocket_option_{option_name} filters

If you need to programmatically deactivate or activate one of WP Rocket's options, you can use WP Rocket's  pre_get_rocket_option_{option_name} filters. 

This can be particularly useful in some cases when you need to apply bulk changes to WP Rocket settings based on any conditions. 

Using these filters:

These filters can be used on your theme's  functions.php file, or in a helper plugin. You can also use the Helper Plugin from this doc: Programmatically toggle WP Rocket options under specific conditions

  • To deactivate an option use __return_zeroadd_filter( 'pre_get_rocket_option_delay_js', '__return_zero' );
  • To activate an option use __return_trueadd_filter( 'pre_get_rocket_option_delay_js', '__return_true' );

List of pre_get_rocket_option_{option_name} filters

pre_get_rocket_option_analytics_enabled
pre_get_rocket_option_async_css
pre_get_rocket_option_async_css_mobile
pre_get_rocket_option_automatic_cleanup_frequency
pre_get_rocket_option_cache_logged_user
pre_get_rocket_option_cache_mobile
pre_get_rocket_option_cache_purge_pages
pre_get_rocket_option_cache_query_strings
pre_get_rocket_option_cache_reject_cookies
pre_get_rocket_option_cache_reject_ua
pre_get_rocket_option_cache_reject_uri
pre_get_rocket_option_cache_ssl
pre_get_rocket_option_cache_webp
pre_get_rocket_option_cdn
pre_get_rocket_option_cdn_cnames
pre_get_rocket_option_cdn_reject_files
pre_get_rocket_option_cdn_zone
pre_get_rocket_option_cloudflare_api_key
pre_get_rocket_option_cloudflare_auto_settings
pre_get_rocket_option_cloudflare_devmode
pre_get_rocket_option_cloudflare_email
pre_get_rocket_option_cloudflare_old_settings
pre_get_rocket_option_cloudflare_protocol_rewrite
pre_get_rocket_option_cloudflare_zone_id
pre_get_rocket_option_consumer_email
pre_get_rocket_option_consumer_key
pre_get_rocket_option_control_heartbeat
pre_get_rocket_option_critical_css
pre_get_rocket_option_database_all_transients
pre_get_rocket_option_database_auto_drafts
pre_get_rocket_option_database_optimize_tables
pre_get_rocket_option_database_revisions
pre_get_rocket_option_database_spam_comments
pre_get_rocket_option_database_trashed_comments
pre_get_rocket_option_database_trashed_posts
pre_get_rocket_option_defer_all_js
pre_get_rocket_option_delay_js
pre_get_rocket_option_delay_js_exclusions
pre_get_rocket_option_dns_prefetch
pre_get_rocket_option_do_caching_mobile_files
pre_get_rocket_option_do_cloudflare
pre_get_rocket_option_emoji
pre_get_rocket_option_exclude_css
pre_get_rocket_option_exclude_defer_js
pre_get_rocket_option_exclude_inline_js
pre_get_rocket_option_exclude_js
pre_get_rocket_option_exclude_lazyload
pre_get_rocket_option_heartbeat_admin_behavior
pre_get_rocket_option_heartbeat_editor_behavior
pre_get_rocket_option_heartbeat_site_behavior
pre_get_rocket_option_image_dimensions
pre_get_rocket_option_lazyload
pre_get_rocket_option_lazyload_css_bg_img
pre_get_rocket_option_lazyload_iframes
pre_get_rocket_option_lazyload_youtube
pre_get_rocket_option_license
pre_get_rocket_option_manual_preload
pre_get_rocket_option_minify_concatenate_js
pre_get_rocket_option_minify_css
pre_get_rocket_option_minify_css_key
pre_get_rocket_option_minify_google_fonts
pre_get_rocket_option_minify_js
pre_get_rocket_option_minify_js_key
pre_get_rocket_option_optimize_css_delivery
pre_get_rocket_option_optimize_css_delivery_method
pre_get_rocket_option_preload_fonts
pre_get_rocket_option_preload_links
pre_get_rocket_option_purge_cron_interval
pre_get_rocket_option_purge_cron_unit
pre_get_rocket_option_remove_unused_css
pre_get_rocket_option_remove_unused_css_safelist
pre_get_rocket_option_schedule_automatic_cleanup
pre_get_rocket_option_secret_cache_key
pre_get_rocket_option_secret_key
pre_get_rocket_option_sitemaps
pre_get_rocket_option_sucury_waf_api_key
pre_get_rocket_option_sucury_waf_cache_sync
pre_get_rocket_option_varnish_auto_purge
pre_get_rocket_option_version
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.