Hi.
I have a site where I would like to add two parameters to all URLs and only when a user is logged in. The parameter values are different from user to user.
Can you point me in the right direction?
This should be possible by using the function below.
add_action('wp_head', 'your_function');
function your_function(){
if ( is_user_logged_in() ) {
$genre_url = add_query_arg('aff', '1234567', get_permalink());
}
}
You can add this to your custom functions at Toolset -> Settings -> Custom Code. Ensure that you've activated it and set it to run on the frontend only.
Secondly replace 'aff' with the name of the url parameter and 1234567 with the value you want to add to the parameter.
Thank you, I will try this.
Is it possible to combine this in a switch conditional?
And is it better to put the code in Toolset -> Settings -> Custom Code than in functions.php?