Ignore Tracking Parameters When Matching Redirects
Strips utm_*, fbclid, gclid and similar tracking parameters from the URL the Redirection plugin matches against, so a redirect still fires when a link arrives from a campaign.
Opens WPIDE on
Code
$wpide_params = array( 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'msclkid', 'mc_cid', 'mc_eid' );
add_filter( 'redirection_request_url', function ( $url ) use ( $wpide_params ) {
return is_string( $url ) && false !== strpos( $url, '?' ) ? remove_query_arg( $wpide_params, $url ) : $url;
} );
Notes
Add parameters to $wpide_params. The visitor's analytics are unaffected because the original URL is only changed for matching.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.