0

I have the following url and I'm using the type parameter in a WP_Query to generate a list of posts.

http://wordpress.dev/en-ie/category-holiday-deals/?type=city-breaks

I want to rewrite the url so it looks like this:

http://wordpress.dev/en-ie/holiday-deals/city-breaks

but I want to be able to use the type param still.

I have the following that's capturing the query vars:

add_filter('query_vars', 'sd_query_vars', 10, 1);

function sd_query_vars($vars) {
    $vars[] = 'type';
    $vars[] = 'destination';
    return $vars;
}

but I can't figure out how to rewrite the URL.

Any suggestions?

1 Answer 1

1

Whenever I've had to handle redirects with WordPress, I have used a plug-in like Rewrite. It gives you a nice interface to create rewrite rules.

I've found it's a lot easier than fiddling with the .htaccess file directly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.