WP_Block_Editor_Context

Class representing a current block editor context.


Description Description

The expectation is that block editor can have a different set of requirements on every screen where it is used. This class allows to define supporting settings that can be used with filters.


Top ↑

Source Source

File: wp-includes/class-wp-block-editor-context.php

final class WP_Block_Editor_Context {
	/**
	 * Post being edited. 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['post'] ) ) {
			$this->post = $settings['post'];
		}
	}
}

Top ↑

Methods Methods


Top ↑

Changelog Changelog

Changelog
Version Description
5.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.