Ignoring query strings | WordPress.org

[ad_1]

Hello,

I understand you’d like to configure WP-Optimize to ignore certain query parameters so that all visitors get served from the cache, irrespective of the query strings in the URL. You can indeed accomplish this by utilizing the available wpo_cache_ignore_query_variables filter hook.

Here’s how you can customize this hook to include specific query parameters that should be ignored by the cache:

function custom_wpo_cache_ignore_query_variables($exclude) {
    $new_variables = array('your_query_var1', 'your_query_var2'); 
    $exclude = array_merge($exclude, $new_variables);
    return $exclude;
}
add_filter('wpo_cache_ignore_query_variables', 'custom_wpo_cache_ignore_query_variables');

Please replace 'your_query_var1' and 'your_query_var2' with the actual query parameters you want WP-Optimize to ignore. Add this code to your theme’s functions.php file or a custom plugin.

This adjustment will ensure that these query parameters do not prevent pages from being served from cache, thereby potentially improving your site’s performance for users who visit your site via referral links that include these parameters.

Let us know if you have any further questions or need assistance. We’re here to help!

Best regards,
Mansour M

  • This reply was modified 3 minutes ago by wpmansour. Reason: removed unknown span

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer