Promo plaatje


WORDPRESS MU PAGES OVERRIDEN BY NEW BLOGS

When using WordPress Mu (WP MU) 2.8.4 or 2.8.5.2 (not tested on older versions) with sub directories it seems one can override the main blog’s pages by creating a blog with the exactly the same name without any warning. Causing visitors to be redirected to the newly created blog instead of the page with the same name. I presume most people would not expect this and in fact it can become quite nasty. So I filled a bug report.

Assume this situation:
You have a WPMU site set using sub directories available at http://mywebsite.dev/. You’re using the primary blog as your website with mostly pages. One of those pages is called “Donation”. You allow other people to register and create a blog. Someone creates a blog called “Donation” and without warning the previous existing page “Donation” has been redirected to the blog “Donation”.

Obliviously, this should not happen.

As I understood from Donncha (lead-developer of WP MU), in earlier version there was a check to prevent this from happening. I haven’t tested older versions so I cannot confirm nor deny this. However in the current and previous stable version of WordPress Mu this unexpected behavior does happen. There are some solutions in order to prevent this from happening:

  • Use sub-domains instead of sub-directories. Since each blog will become a sub-domain instead of a sub-directory it will not clash with any pages created in the
    main blog.
  • Prevent any blogs from being created with the same slug (path) as a page in the primary blog. This fixes the issue with WP MU and sub-directories

I created a plugin called “bbMuAutoBanPage” for the latter, which uses the “Banned Names” option in the site admin. Basically it keeps track of the pages created in the primary blog and adds the slugs to the illegal_names options which is used for the “Banned Names” functionality. This is a temporarily fix until this issue is properly fixed in the core WP MU code. Until then you can use my plugin, which I highly recommend if you allow people to register their own blog on your WP MU install. DOWNLOAD IT HERE

In my humble opinion this would be a great moment to have a closer look at the way WordPress Mu deals with routing, since I would like to see it allow for more fine-grained control.

— ♦ —

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>