• I”m trying to create a plugin, and while I’m not entirely sure of the direction of that plugin, my first step was just to make sure I knew how to get a page on the Dashboard.

    When trying to logout and login, there are “headers already sent” errors. The code for the plugin is below, and it’s awfully simple to be producing errors. Which is to say, I have no clue. ??

    The plugin generated 1 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
    <?php
    
    // Plugin Name: My Team
    // Plugin URI:
    // Description: Allows a coach to enter information about his team and players
    // Version: 0.1
    
    add_action('admin_menu', 'my_plugin_menu');
    
    function my_plugin_menu() {
    
      add_dashboard_page('My Plugin Options', 'My Team Settings', 'manage_options', 'my-unique-identifier', 'my_plugin_options');
    
    }
    
    function my_plugin_options() {
    
      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>';
    
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Trying to create plugin: An error in trying to add settings to Dashboard…’ is closed to new replies.