parent_file

最后更新于:2021-11-27 13:13:23

apply_filters( ‘parent_file’, string $parent_file )

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

参数

$parent_file

(string)
The parent file.

源文件

文件: gc-admin/menu-header.php

View on Trac

/**
 * Sets the parent file for hidden sub menus.
 * Showing the parent menu active.
 * 
 * @param $parent_file
 *
 * @return mixed
 */
function gcorg_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', 'gcorg_func_parent_file_callback' );