• hansmichael

    (@hansmichael)


    What I wanted to achieve:
    Link to a small option page for my plugin via plugin_action_links_
    No entry in the settings side bar menu needed.

    What I tried
    To get the option page / a page shown in the admin screen I used add_option_page.
    But this adds an entry to the menu, unnecessarily. (Workaround: $menu_title = ”, $position = -99999)

    Suggestion
    add_option_page add argument menu on / off

    Related: The way to link an option page via plugin_action_links_ is not beeing shown in the developers handbook.

    • This topic was modified 6 years ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not a Requests and Feedback topic
Viewing 1 replies (of 1 total)
  • Matias Mann

    (@developress)

    You can use this filter to add the menu item:

    // Link to settings page from plugins screen
    add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'add_action_links' );
    function add_action_links ( $links ) {
        $mylinks = array(
            /* options-general.php?page=mysettings Will create a link under Settings
             * themes.php?page=mysettings Will create a link under Appeareance
             * tools.php?page=mysettings Will create a link under Tools
             */
            '<a href="' . admin_url( 'options-general.php?page=mysettings' ) . '">Link Name in Menu</a>',
        );
        return array_merge( $links, $mylinks );
    }

    Taken from WordPress documentation: https://developer.wordpress.org/reference/hooks/plugin_action_links_plugin_file/

Viewing 1 replies (of 1 total)

The topic ‘add_option_page without menu entry’ is closed to new replies.