In a recent project, I had to redirect a specific category archive to a WordPress page. I wanted to show special content when people were accessing the category archive page. This is actually pretty easy using the WordPress wp_redirect function.
So I wanted to redirect the category called customers to a specific page. Here is how you can do this.
1. Create a php file in the template folder called category-customers.php. Using this name WordPress will pickup this file automatically when the category archive customers is accessed
2. In the file paste the following code:
<?php wp_redirect( get_permalink(get_option(‘rc4_page_customers’)), 301 ); exit; ?>
You can actually drop this part:
get_permalink(get_option(‘page_customers’))
and replace it with a static url. I used this part to determine the url of a page I set in the admin settings for the theme. get_option will find the option called page_customers. This is useful in case the url of the page is changed by the user. So I recommend doing it.
The 301 parameter in the wp_redirect function just tell the search engine and bot the page has been moved permanently.
That’s it, pretty easy. For more info on wp_redirect, visit this link: http://codex.wordpress.org/Function_Reference/wp_redirect