Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a plugin that has 3 pages. One of those pages, I don't want displayed in the admin menu (working), but when a user is on that page, I want the plugin menu to be active.

I'm using the parent_file filter, but it isn't working.

I've had a look in the core, and alghouth the filter seems to be accepting the correct value ($parent_file = 'charts'), by the time the menu is being output, something else has changed it back ($parent_file = 'edit-chart').

/**
 * Highlight the 'Charts' top level menue when viewing the 'Edit Chart' page
 */
function on_menu_parent($parent_file) {

    global $current_screen;

    $base = $current_screen->base;
    if($base == 'admin_page_edit-chart') :
        $parent_file = 'charts';
    endif;

    return $parent_file;

}

The filter, called from the Plugin Class constructor is this -

add_filter('parent_file', array(&$this, 'on_menu_parent'));

Does anybody know how to get this working correctly? Thanks.

share|improve this question

1 Answer 1

If written the "Current Admin Info" plugin for exactly that reason: Find what you need, when you need it. It adds a help tab with all the currently available (contextual info).

enter image description here

enter image description here

share|improve this answer
1  
This. This is very cool. –  TheDeadMedic Nov 22 '12 at 18:27
    
@TheDeadMedic Thanks :) Btw: It's extensible. So if you got other classes (a.k.a. Help Tabs), you want to incorporate, feel free to send me a pull request. –  kaiser Nov 22 '12 at 18:54
    
While I thank you for you answer, I don't understand how this can help me. I've tried to install it, as maybe I'm misunderstanding it's purpose, but with it active, no extra info is available in any of my help tabs? –  David Gard Nov 23 '12 at 10:03
    
@DavidGard You have "tried" to install it, or did you install it? Are you saying, that you can't see the additional help tabs? Please clarify. –  kaiser Nov 23 '12 at 12:56
    
Installed and cannot see any additional help tabs. Thanks. –  David Gard Dec 3 '12 at 10:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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