1

Here I want to have upon activation of my wordpress plugins activation

Before Activation

Activate | Edit | Delete

After Activation

Settings | Edit | Delete

How can this be done in code to add this Menu

1
  • 1
    Those are called action links.
    – scribu
    Aug 5, 2011 at 2:24

2 Answers 2

4

Code extracted from my plugin, adapt as necessary.

add_filter( 'plugin_action_links', 'wpse_25030_settings_plugin_link', 10, 2 );

function wpse_25030_settings_plugin_link( $links, $file ) 
{
    if ( $file == plugin_basename(dirname(__FILE__) . '/many-tips-together.php') ) 
    {
        /*
         * Insert the link at the beginning
         */
        $in = '<a href="options-general.php?page=many-tips-together">' . __('Settings','mtt') . '</a>';
        array_unshift($links, $in);

        /*
         * Insert at the end
         */
        // $links[] = '<a href="options-general.php?page=many-tips-together">'.__('Settings','mtt').'</a>';
    }
    return $links;
}
0
    public function my_plugin_action_links( $links ) {
       $mylinks[] = '<a href="'. get_admin_url(null, 'admin.php?page=settings') .'">'.__('Settings', 'woocommerce').'</a>';

       return $mylinks + $links;
    }       

Adding return $mylinks + $links;, it orders the array

2
  • Your answer seems a little uncomplete. You should explain further what the code does and why it answers the question.
    – cybmeta
    Nov 27, 2014 at 12:22
  • Sorry, but I don't have so much time. Nov 28, 2014 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.