apply_filters( 'parent_file', string $parent_file )

Filters the parent file of an admin menu sub-menu item.


Description

Allows plugins to move sub-menu items around.


Top ↑

Parameters

$parent_file string
The parent file.

Top ↑

Source

File: wp-admin/menu-header.php. View all references

$parent_file = apply_filters( 'parent_file', $parent_file );

Top ↑

Changelog

Changelog
Version Description
MU (3.0.0) Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Adarsh Verma

    Example:

    /**
     * Sets the parent file for hidden sub menus.
     * Showing the parent menu active.
     * 
     * @param $parent_file
     *
     * @return mixed
     */
    function wporg_func_parent_file_callback( $parent_file ) {
    
    	global $plugin_page;
    	if ( 'my-plugin-custom-child' === $plugin_page ) {
    		$plugin_page = 'my-plugin-custom-parent';
    	}
    	return $parent_file;
    
    }
    add_filter( 'parent_file', 'wporg_func_parent_file_callback' );

You must log in before being able to contribute a note or feedback.