Home / plugin / Add plugin settings link to plugins list table
  • How to Add plugin settings link to plugins list table

    add-plugin-settings-link-plugins-list-table

    When building a plugin that has its own settings page, it’s often handy to create a link to the settings page straight from the Plugins page in the dashboard – this saves users the time it takes to find where exactly your plugin appears in the admin menu. Here is a simple code snippet that creates the settings link for you – all you need to do is set the link to point to the right place. This code must be placed in your plugin’s index file.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    function plugin_add_settings_link( $links ) {
        $settings_link = '<a href="options-general.php?page=plugin_name">' . __( 'Settings' ) . '</a>';
        array_push( $links, $settings_link );
      	return $links;
    }
    $plugin = plugin_basename( __FILE__ );
    add_filter( "plugin_action_links_$plugin", 'plugin_add_settings_link' );
    

    ( WordPress codex functions, hooks, in this snippet. )

    add_filter, plugin_basename, __, _n,