WP_Screen::set_parentage() WordPress Method

The WP_Screen::set_parentage() method sets the parentage of a screen. This is useful in cases where a screen needs to have multiple parents, such as when a screen is created by a plugin but is also part of the WordPress admin. In most cases, a screen will only have one parent, but this method allows for multiple parents to be set.

WP_Screen::set_parentage( string $parent_file ) #

Set the parent information for the screen.


Description

This is called in admin-header.php after the menu parent for the screen has been determined.


Top ↑

Parameters

$parent_file

(string)(Required)The parent file of the screen. Typically the $parent_file global.


Top ↑

Source

File: wp-admin/includes/class-wp-screen.php

	public function set_parentage( $parent_file ) {
		$this->parent_file         = $parent_file;
		list( $this->parent_base ) = explode( '?', $parent_file );
		$this->parent_base         = str_replace( '.php', '', $this->parent_base );
	}

Top ↑

Changelog

Changelog
VersionDescription
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.