Peter Westwood: Making your broken Plugin work again with WordPress 2.8.1
168 Views Published 7 months, 4 weeks ago in WordpressWordPress 2.8.1 contains changes to improve the security of plugins by ensuring that only correctly registered plugin pages can be accessed as well as only showing the link to the page to users who have the capability required in the add_x_page call.
This change has broken a number of plugins which were adding there menus on the wrong action hook bypassing some capability checks.
The correct hook to use, as documented in the codex, is admin_menu. However, some plugins have successfully in the past been using admin_init but this meant that they bypassed some of the capability checking that WordPress does to help limit access to plugins pages.
This capability checking is there to help limit access to plugin added pages but plugins must always use current_user_can() to check the capability they require to ensure they prevent access to incapable users.
The code to look for in your plugins is something like this:
add_action('admin_init', 'my_plugin_menu');
function my_plugin_menu() {
add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'your-unique-identifier', 'my_plugin_options');
}
Which should be:
add_action('admin_menu', 'my_plugin_menu');
function my_plugin_menu() {
add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'your-unique-identifier', 'my_plugin_options');
}
And don’t forget while checking your plugin for this issue go and check to make sure you use current_user_can() to check user capabilities before allowing them to access your plugin page functionality.

Search
About This Entry
- You’re currently reading “Peter Westwood: Making your broken Plugin work again with WordPress 2.8.1,” an entry on The Staff Lounge
- Published at 7.15.09 / 7am
Related Entries
- Weblog Tools Collection: Bookmarklet to Quickly Access WordPress Admin Menu - Wordpress
- Weblog Tools Collection: WordPress Plugin Development Beginner’s Guide - Wordpress
- Weblog Tools Collection: WordPress Plugin Releases for 10/02 - Wordpress
- Ryan: 2.8 Plugin Compatibility - Wordpress
- Weblog Tools Collection: Plugin Review: Improved Plugin Installation - Wordpress
Recent Entries
- Mike Little: Interview with Matt Mullenweg and Mike Little - Wordpress
- WordPress.tv: Jayson Cote: The Power of WordPress, You, and Your Business - Wordpress
- WordPress.tv: Brent Spore: Designing for WordPress - Wordpress
- WordPress.tv: Clintus McGintus: Video Blogging and Video Marketing - Wordpress
- WordPress.tv: Interview with Matt Mullenweg and Mike Little - Wordpress
Popular Resources
- Phorum-5.2.8 final released (13 replies) - 29788 Views
- Phorum-5.2.9a released (10 replies) - 26498 Views
- IPB Resources - 10788 Views
- Weblog Tools Collection: WordPress Theme Releases for 01/14 - 9369 Views
- Weblog Tools Collection: WordPress Theme Releases for 01/10 - 8686 Views







This is right but may not be enough as you cannot add a menuitem for all php files
Still there is a trick :
http://www.lautre-monde.fr/wordpress-2-8-1-et-la-securite/
Basically, it is about turning on a global var thus allowing the page to be browsed…