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.

Parameters

$parent_filestring
The parent file.

Source

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

Changelog

VersionDescription
MU (3.0.0)Introduced.

User Contributed Notes

  1. Skip to note 2 content

    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.