WP Beginner recently had a simple tutorial on how to diable the XML-RPC in WordPress, as @nacin points out, it’ll be enabled by default in WordPress 3.5. Security wary website owners would be wise to decide for themselves if this is a good idea, and the WP Beginner article gives you a quick tutorial on how to disable it.
What was interesting to me however was a question left in the comments by Keith:
Sorry to be a bit thick but could you expand on… “All you have to do is paste the following code in a site-specific plugin:”
Which plugins are site specific?
The answer of course is no plugins are site specific unless you make them, which leads me to this article.
What is a site specific plugin?
At the most basic level a WordPress plugin is a way to extend WordPress, and a site specific plugin is one that is designed to only be executed on a singe website, or in some limited environments a group of sites for a specific task.
Most often this is to host PHP functions commonly stored in the functions.php file (or a site specific plugin for WordPress) which do not directly relate to the theme. This way, site functionality can be maintained and separated from the theme file.
Why would I need a plugin specific to one website?
Anytime you want to have code unique to a website but not dependent on the theme, using a site specific plugin is the best way to accomplish this goal.
For example, on thisismyurl.com I maintain about 40 unique shortcodes, many of which I need to run the site. If I changed themes, I would lose these shortcodes or be required to move them to the new theme. If on the the other hand they’re stored in a plugin, I can change themes often and not risk losing unique code.
Can site specific plugins ever be used on multiple sites?
Yes, while they’re commonly used to house the functionality of a single domain, the can also be used to share important functionality across multiple sites within a family of sites.
Websites which host multiple versions for example, be that for mobile devices vs. desktops, geographical requirements (Europe or the Americas), or language needs (English, French). Site specific plugins allow shortcodes, functions, Widgets, etc to be stored and shared without needing to replicate code in individual functions.php files.
How do I create a site plugin?
Creating a site specific plugin is the same as creating any other WordPress plugin but instead of uploading it to WordPress.org or distributing it, you’ll upload and activate it on your own WordPress blog.
Here’s a simple empty site specific plugin for WordPress to get you started:
If you simply copy that code into a new PHP file and upload it to your wp-content/plugins/ folder, you’ll be able to activate the plugin in your WordPress Plugins page although at the moment it doesn’t do anything.
This version of the plugin adds the unique code from WP Beginners article to your website.
Should I a site specific plugin on a multisite version of WordPress?
There’s absolutely no reason not to. Each site specific plugin can be installed on a multisite version of WordPress and activated individually.
Alternatively, for website owners with multiple sites of a similar nature you can use this method to create and share common functionality on a multisite version of WordPress. For example, I run a few websites off a single shared plugin which generates my headers, footers and allows access to shortcodes across all sites.
Let me know if you have any other great uses for site specific WordPress plugins