Created
October 10, 2018 07:35
-
-
Save DavidSteinbauer/41f03b79252b1558d96088fc6de98b1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Adding Parameters to Permalinks | |
* | |
*/ | |
add_filter( 'post_type_link', 'lc_append_query_string', 10, 2 ); | |
function lc_append_query_string( $url ) | |
{ | |
if(is_admin()) return $url; | |
$query = array(); | |
if(isset($_GET['utm_medium']) && $_GET['utm_medium'] == 'frame') { | |
$query[] = 'utm_medium=frame'; | |
} | |
if(isset($_GET['utm_source']) && $_GET['utm_source'] == 'pillenstein_de') { | |
$query[] = 'utm_source=pillenstein_de'; | |
} | |
return (empty($query)) ? $url : $url.'?'.implode('&', $query); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment