Categories
CMS Mastering Development Wordpress

How to add a prefix to a WordPress post preview url?

I need to remove any query parameters from the WordPress post preview URL.

I need to access https://www.domain.com/prefix/12345 and see the same post preview I would see on https://www.domain.com/?p=12345&preview=true

It can not redirect, the URL in the browser must still be https://www.domain.com/prefix/12345

As an alternative, adding a prefix to the original WordPress post preview url would also be enough:
https://www.domain.com/previx/?p=12345&preview=true

How can I achieve one of these without changing the URLs of the published posts?

The motivations is that I need a URL with a prefix to create a bypass rule on CloudFlare Workers.

Leave a Reply

Your email address will not be published. Required fields are marked *