Change Query String to pretty permalink

Question

I have a link
http://www.example.com/my-account/view-pet/?pet-page=2

I want to change it to either

Here’s what I have tried to so far

function wpse12065_init() {
    add_rewrite_rule('view-pet(/([^/]+))?(/([^/]+))?/?',
        'index.php?pagename=my-account/view-pet&pet-page=$matches[2]',
        'top');
}
add_action( 'init', array( $this, 'wpse12065_init' ) );

I am able to get the ?pet-page=2 using get_query_var( 'pet-page' )

I have also had a look through the THIS and its still not working

Any help would be greatly appreciated

0
bagpipper 4 months 0 Answers 20 views 0

Leave an answer