I have a plugin installed in my wordpress site which allows user logins as contributor. But the settings tab for this plugin appears even if user logins as contributors. Is there a quick way to make sure the plugin settings appear only for administrators?
views:
12answers:
1
A:
In the function where you register the plugin settings page, there's an argument for capability. Setting that to a higher capability (I usually use 'manage_options'
) prevents unauthorized access. For example:
add_options_page( 'My Options Page', 'My Options Page', 'manage_options', 'my-options-page', 'function_to_render_page' );
For more information, see the WordPress codex page on adding administration pages:
John P Bloch
2010-09-24 21:13:18