add_options_page not adding option to admin page

So have the following code, which I am trying to create a custom plug-in for WordPress:

<?php

/*
    Plugin Name: Dump-It Scheduler
    Plugin URI: mycompany.com
    Description: my description
    Version: 1.0
    Author: Blaine 
    Author URI: myuri.net
    License: 

*/

function scheduler_admin_actions() {
    add_options_page('Dump-It Scheduling', 'Dump-It Schedule', 'Administrator', 'Dump-It_Master_Schedule'); 
}

add_action('admin_menu', 'scheduler_admin_actions'); 

?>

However, I don’t see any addition link in the admin section of the app. I have activated the plugin, but I expect to see an option for this plugin. From what I understand I should see a link added to the admin panel.

Read More

I’ll also add that I don’t have any errors (I’m using a debugger plugin). Can’t figure out what is going on here…

I am using WordPress 3.6.1 in case it matters.

What am I missing?

Related posts

Leave a Reply

2 comments

  1. The third parameter is a capability, and has to be manage_options or similar in your case. It even can be a role (although not recommended), but it has to be small caps and not Administrator.

    You are missing the last parameter, which is the callback.

    # http://codex.wordpress.org/Function_Reference/add_options_page
    add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function);
    

    The order doesn’t matter, this works:

    function scheduler_admin_actions() {
        add_options_page(
            'Dump-It Scheduling', 
            'Dump-It Schedule', 
            'manage_options', 
            'Dump-It_Master_Schedule', 
            'my_callback'
        ); 
    }
    function my_callback()
    {
        echo 'hello world';
    }
    add_action('admin_menu', 'scheduler_admin_actions'); 
    
  2. As it turns out, I had to move the add_action above the function like so:

      <?php
    
        /*
            Plugin Name: Dump-It Scheduler
            Plugin URI: mycompany.com
            Description: my description
            Version: 1.0
            Author: Blaine 
            Author URI: myuri.net
            License: 
    
        */
        //moved this call above the function definition
        add_action('admin_menu', 'scheduler_admin_actions'); 
    
        function scheduler_admin_actions()
        {
            add_options_page('Dump-It Scheduling', 'Dump-It Schedule', 'Administrator', 'Dump-It_Master_Schedule'); 
        }
    
    ?>