Using Wordpress, I would like to redirect to a certain page on the site if the user visits an archive is_archive()
.
How would I go about this? Could I add something to functions.php
?
Using WordPress hook in functions.php
, just paste this snippet in your functions.php
function redirect_to_url(){
if(is_archive()){
$url='your redirect url url';
wp_redirect( $url );
}
}
add_action('template_redirect', 'redirect_to_url');
There is an article here, it may help you.