Exclude / Blacklist Permalinks

I’m building a website and I was wondering if it is possible to exclude certain permalinks from beings used.

For example: if my website has a demo of a project running on www.example.com/demo/ and a user creates a page called demo, I don’t want WordPress to create a permalink like www.example.com/demo/.

Read More

Is there a way to exclude these permalinks? So that WordPress will take the next available permalink? Like www.example.com/demo-2/ or something?

Related posts

1 comment

  1. Interesting question. I found this post and tested, it worked for me:

    http://wpdreamer.com/2012/03/how-to-define-reserve-slugs-for-wordpress-posts-and-pages/

    If you don’t want to edit your functions.php file an inelegant solution you can try is to create empty placeholder pages with the permalinks you’d like to reserve. If there is a physical directory on the server with that same name that would take precedence over the rewritten WordPress URL. So for example, if you create a WordPress page with slug “demo” and a physical directory in your web public dir called, “demo” you could use that for your demo site files.

    Personally I like to use subdomains for this purpose myself to keep any demo work segregated from production, but that’s just an opinion.

Comments are closed.