Changeset 9868
- Timestamp:
- 05/13/2020 05:15:32 AM (4 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-redirects.php
r9867 r9868 1 1 <?php 2 3 /**4 * Custom Canonical redirect for Facebook and Twitter referrers.5 */6 add_action( 'template_redirect', function() {7 8 // Only run on pages with canonical enabled.9 if ( ! has_action( 'template_redirect', 'redirect_canonical' ) ) {10 return;11 }12 13 $url = false;14 if ( isset( $_GET['fbclid'] ) ) {15 $url = remove_query_arg( 'fbclid' ) . '#utm_medium=referral&utm_source=facebook.com&utm_content=social';16 } elseif ( isset( $_GET['__twitter_impression'] ) ) {17 $url = remove_query_arg( '__twitter_impression' ) . '#utm_medium=referral&utm_source=twitter.com&utm_content=social';18 }19 20 if ( $url ) {21 wp_safe_redirect( $url, 301 );22 exit;23 }24 25 }, 9 ); // Before redirect_canonical();26 2 27 3 /*
Note: See TracChangeset
for help on using the changeset viewer.