WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've used almost all of the Wordpress example code but it still doesn't work. I've put the php file under wp-content/plugins/menuitem/ .The code is simple

<?php add_action('admin_menu', 'donations_overview_menu');
function donations_overview_menu() {
    add_options_page('Donations overview', 'Donations overview', 'manage_options', 'donations-overview', 'donations_overview');}

function donations_overview() {
    if (!current_user_can('manage_options'))  {
        wp_die( __('You do not have sufficient permissions to access this page.') );
    echo '<div class="wrap">';
    echo '<p>Here is where the form would go if I actually had options.</p>';
    echo '</div>';
share|improve this question
up vote 1 down vote accepted

The code itself is fine. But you would need to activate the plug-in: you can't simply place the file in the plug-ins directory. You will need to give the plug-in a 'header' too. See the Codex.

Alternatively, place the code in your theme's functions.php, but really it should be in a plug-in.

share|improve this answer
I thought that I was missing something, rather than writing wrong code, thank you. – Andrija Jan 19 '12 at 19:46

add_options_page adds a page to the Settings tab of the dashboard, not its own tab. I just copied your code and pasted into a plugin and verified that it is adding Donations overview to the Settings tab.

Also as Stephen Harris said, your plugin needs to have the valid plugin headers and be activated in order for any code inside of it to run.

share|improve this answer
I know, I wanted to add it to the Settings; thanks for checking it out. – Andrija Jan 19 '12 at 19:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.