apply_filters( 'parent_file', string $parent_file )

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

Description Description

Allows plugins to move sub-menu items around.

Top ↑

Parameters Parameters


(string) The parent file.

Top ↑

Source Source

File: wp-admin/menu-header.php

View on Trac

Top ↑

Changelog Changelog

Version Description
MU (3.0.0) Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Adarsh Verma


     * 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.