How to add rewrite rule for product compare page?

Here you go: compare\/([^-vs-]*)(?:-vs-)([^-vs-]*)(?:-vs-)?([^-vs-]*)? Remember to escape backslashes (as I have done). I also made your lookups more consistent in their internal logic/structure. I assumed you wouldn’t want a second -vs- if the third product wasn’t there, so this is why you now have the second non-capturing group. Here is a link with the answer … Read more

catch urls with specific pattern and show specific content for them by plugin

There might be other ways, but what I would so is create a rewrite rule in your .htaccess file, something like: RewriteRule ^items/([0-9]*) /items/?page=$1 Now your user sees: http://mywordpress_site.com/items/1/ But behind the scenes, your site sees: http://mywordpress_site.com/items/?page=1 Then in your shortcode: $page = (int) $_GET[‘page’]; WP has tools in it to manage rewrites, and it … Read more