Add_options_page does not add an option to the admin page

I have the following code that I am trying to create a custom WordPress plugin:

<?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 do not see the add link in the application admin section. I have activated the plugin, but I expect to see an option for this plugin. As far as I understand, I should see a link added to the admin panel.

I will also add that I have no errors (I am using a debugger plugin). I can’t understand what is happening here ...

I use WordPress 3.6.1 if that matters.

What am I missing?

+4
source share
2 answers

- manage_options . ( ), , Administrator.

, .

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

, :

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'); 
+3

, add_action :

  <?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'); 
    }

?>
+1

All Articles