wppaste
WordPress

WP_Block_Editor_Context

Since
5.8.0
Source
wp-includes/class-wp-block-editor-context.php:14
Contains information about a block editor being rendered.

Compatibility

WordPress
since 5.8.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 2

$namestringpublic
String that identifies the block editor being rendered. Can be one of:
$postWP_Post|nullpublic
The post being edited by the block editor. Optional.

Methods · 1

Source code

#[AllowDynamicProperties]final class WP_Block_Editor_Context {	/**	 * String that identifies the block editor being rendered. Can be one of:	 *	 * - `'core/edit-post'`         - The post editor at `/wp-admin/edit.php`.	 * - `'core/edit-widgets'`      - The widgets editor at `/wp-admin/widgets.php`.	 * - `'core/customize-widgets'` - The widgets editor at `/wp-admin/customize.php`.	 * - `'core/edit-site'`         - The site editor at `/wp-admin/site-editor.php`.	 *	 * Defaults to 'core/edit-post'.	 *	 * @since 6.0.0	 *	 * @var string	 */	public $name = 'core/edit-post'; 	/**	 * The post being edited by the block editor. Optional.	 *	 * @since 5.8.0	 *	 * @var WP_Post|null	 */	public $post = null; 	/**	 * Constructor.	 *	 * Populates optional properties for a given block editor context.	 *	 * @since 5.8.0	 *	 * @param array $settings The list of optional settings to expose in a given context.	 */	public function __construct( array $settings = array() ) {		if ( isset( $settings['name'] ) ) {			$this->name = $settings['name'];		}		if ( isset( $settings['post'] ) ) {			$this->post = $settings['post'];		}	}}

Changelog

Introduced in 5.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/class-wp-block-editor-context.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.