[wp-hackers] No more "sidemenu" action...

Matt Martz matt at sivel.net
Fri Oct 17 15:36:38 GMT 2008

On Fri, Oct 17, 2008 at 10:55 AM, Jennifer Hodgdon
<yahgrp at poplarware.com> wrote:
> Is there a way for a plugin to add to the "favorites" drop-down?

There is indeed a way.  A filter was added for such tasks.

Here is some sample code for creating a plugin:

function add_to_favorites( $favorites_array ) {
        $favorites_array['#myhref'] = array('Change Language', 'read');
        return $favorites_array;

add_filter('favorite_actions', 'add_to_favorites');

I'll break down the one line so it makes more sense

        $favorites_array['#myhref'] = array('Change Language', 'read');

We want to insert a new key into the array where the key is the href
for the link.  In this case I just made it '#myhref' but could be
anything like 'options.php'.

The value for that key is an array where the first element is the
display text and the second is the minimum user role required to see
that link in the favorites.

Matt Martz
matt at sivel.net

More information about the wp-hackers mailing list