1

i want rewrite some urls in wordpress

from http://localhost/wordpress/my-page/2/

to http://localhost/wordpress/my-page/part-2/

anyone can help? Now i am using something like this but it not working.

    function rewrite_url()
{
    add_rewrite_rule(
        '^(my-page)/([^/]*)/?', 
        'index.php?pagename=$matches[1]&my-page=$matches[2]',
        'top'
    );
}
add_action('init', 'rewrite_url');

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.