I have a link http://www.example.com/my-account/view-pet/?pet-page=2
I want to change it to either
- http://www.example.com/my-account/view-pet/pet-page/2 or
- http://www.example.com/my-account/view-pet/2
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