Filter hook 'wp_editor_expand'

in WP Core File wp-admin/edit-form-advanced.php at line 53

View Source

wp_editor_expand

Filter Hook
Description
Filters whether to enable the 'expand' functionality in the post editor.

Hook Information

File Location wp-admin/edit-form-advanced.php View on GitHub
Hook Type Filter
Line Number 53

Hook Parameters

Type Name Description
bool $expand Whether to enable the 'expand' functionality. Default true.
string $post_type Post type.

Usage Examples

Basic Usage
<?php
// Hook into wp_editor_expand
add_filter('wp_editor_expand', 'my_custom_filter', 10, 2);

function my_custom_filter($expand, $post_type) {
    // Your custom filtering logic here
    return $expand;
}

Source Code Context

wp-admin/edit-form-advanced.php:53 - How this hook is used in WordPress core
<?php
  48  	 * @since 4.1.0 Added the `$post_type` parameter.
  49  	 *
  50  	 * @param bool   $expand    Whether to enable the 'expand' functionality. Default true.
  51  	 * @param string $post_type Post type.
  52  	 */
  53  	if ( apply_filters( 'wp_editor_expand', true, $post_type ) ) {
  54  		wp_enqueue_script( 'editor-expand' );
  55  		$_content_editor_dfw = true;
  56  		$_wp_editor_expand   = ( 'on' === get_user_setting( 'editor_expand', 'on' ) );
  57  	}
  58  }

PHP Documentation

<?php
/**
	 * Filters whether to enable the 'expand' functionality in the post editor.
	 *
	 * @since 4.0.0
	 * @since 4.1.0 Added the `$post_type` parameter.
	 *
	 * @param bool   $expand    Whether to enable the 'expand' functionality. Default true.
	 * @param string $post_type Post type.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-admin/edit-form-advanced.php
Related Hooks

Related hooks will be displayed here in future updates.