At this point in time, WordPress remains the easiest-to-use “CMS” available to us, so I end up developing quite a few sites with it. Somehow, there is this great feature I’ve never heard of until a few weeks back, so I thought I’d share with the class.

WordPress has this feature called “Must Use Plugins“, aka mu-plugins. They go in the directory /wp-content/mu-plugins/ which does not exist by default. WordPress will load every .php file in that top level directory, before regular plugins. In my efforts to write less crappy code on WordPress, this directory has proved invaluable. However, rarely do you want a bunch of .php files in that directory. Normally, you’d want a system more like the regular plugin directory where each plugin can be a file OR a directory.

I wrote up a little proxy loader script that accomplishes this. Just save as /wp-content/mu-plugins/proxy-loader.php or something, and it will load either /wp-content/mu-plugins/<plugin-name>/<plugin-name>.php OR /wp-content/mu-plugins/<plugin-name>/plugin.php if those files exist. The plugin is available via GitHub.

I just updated one of my more popular plugins, WordPress Access Control. The newest version, 3.0, includes an admin options interface for setting various default values and behaviours. I’ve also added compatibility for posts and custom post types (Directly from the admin interface), and fixed issues with searching. You can now decide to not show members only pages in search results, show only a title with a custom message instead of an excerpt, or show the title and excerpt but require a login for the full article.

In addition to the above changes I added two shortcodes, and for restricting specific content on a page to either members or non-members. Enjoy!

I released my my walker class as a super easy to use plugin (This doesn’t even require you to change your wp_nav_menu commands as it uses a filter to add it). I’ve submitted it to WordPress.org so I’ve linked to it below.

Just install and activate it, and then you can go to a page and mark it as Members Only.

Now featuring full support for wp_page_menu AND wp_nav_menu. Tested on WordPress 2.9+. Also fully compatible with PHP 4+!