Ignoring query strings with premium version
-
I read on a previous thread that you require the premium version for a function to exclude query strings so that the cached version of the page is served.
I bought the premium version and included this function in our functions.php file:function custom_wpo_cache_ignore_query_variables($exclude) {
$new_variables = [
'fbclid',
'gclid',
'gclsrc',
'dclid',
'gbraid',
'wbraid',
'twclid',
'yclid',
'utm_content',
'utm_term',
'utm_campaign',
'utm_medium',
'utm_source',
'utm_id',
'utm_source_platform',
'utm_creative_format',
'utm_marketing_tactic',
'_ga',
'_gl',
'mc_cid',
'mc_eid',
'_bta_tid',
'_bta_c',
'trk_contact',
'trk_msg',
'trk_module',
'trk_sid',
'gdfms',
'gdftrk',
'gdffi',
'_ke',
'_kx',
'redirect_log_mongo_id',
'redirect_mongo_id',
'sb_referer_host',
'mkwid',
'pcrid',
'ef_id',
's_kwcid',
'msclkid',
'dm_i',
'epik',
'pk_campaign',
'pk_kwd',
'pk_keyword',
'piwik_campaign',
'piwik_kwd',
'piwik_keyword',
'mtm_campaign',
'mtm_keyword',
'mtm_source',
'mtm_medium',
'mtm_content',
'mtm_cid',
'mtm_group',
'mtm_placement',
'matomo_campaign',
'matomo_keyword',
'matomo_source',
'matomo_medium',
'matomo_content',
'matomo_cid',
'matomo_group',
'matomo_placement',
'hsa_cam',
'hsa_grp',
'hsa_mt',
'hsa_src',
'hsa_ad',
'hsa_acc',
'hsa_net',
'hsa_kw',
'hsa_tgt',
'hsa_ver',
'_branch_match_id',
'mkevt',
'mkcid',
'mkrid',
'campid',
'toolid',
'customid',
'igshid',
'si',
'sms_source',
'sms_click',
'sms_uph',
'ttclid',
'ndclid',
'ScCid',
'rtid',
'irclickid',
'srsltid'
];
$exclude = array_merge($exclude, $new_variables);
return $exclude;
}
add_filter('wpo_cache_ignore_query_variables', 'custom_wpo_cache_ignore_query_variables');
/------------------------------------------------------------------------/
/------------------------------------------------------------------------/Unfortunately, this doesn’t work. I tested this on an organic result that includes the “?srsltid” query string. When viewing the source of a page, I see this message in the footer: <!– WP Optimize page cache – https://getwpo.com – Page not served from cache –>
I want to serve cached pages for users from organic searches on Google, Google Ads, and any meta campaigns.
For example, on some organic results, this is added to the end of the URL: ?srsltid=xxx where xxx is an ID.
How can we serve cached pages to those users?
- You must be logged in to reply to this topic.