I want to add custom rewrite rules for my url having GET parameters on homepage e.g http://example.com/?jobs=1 should be http://example.com/jobs/1.

Note: Get params can be string as well

Well I have tried below code,

function my_rewrite_tag() {
add_action('init', 'my_rewrite_tag', 10, 0);

add_filter('query_vars', function($vars) {
    $vars[] = "test";
    return $vars;

As well tried below code,

function custom_rewrite_rule() {
add_action('init', 'custom_rewrite_rule', 10, 0);

This code gives me 404 error, what am I doing wrong here?

Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.