use_block_editor_for_post( int|WP_Post $post )
Return whether the post can be edited in the block editor.
Description Description
Parameters Parameters
Return Return
(bool) Whether the post can be edited in the block editor.
Source Source
File: wp-admin/includes/post.php
2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 | function use_block_editor_for_post( $post ) { $post = get_post( $post ); if ( ! $post ) { return false; } // We're in the meta box loader, so don't use the block editor. if ( isset( $_GET [ 'meta-box-loader' ] ) ) { check_admin_referer( 'meta-box-loader' ); return false; } // The posts page can't be edited in the block editor. if ( absint( get_option( 'page_for_posts' ) ) === $post ->ID && empty ( $post ->post_content ) ) { return false; } $use_block_editor = use_block_editor_for_post_type( $post ->post_type ); /** * Filter whether a post is able to be edited in the block editor. * * @since 5.0.0 * * @param bool $use_block_editor Whether the post can be edited or not. * @param WP_Post $post The post being checked. */ return apply_filters( 'use_block_editor_for_post' , $use_block_editor , $post ); } |
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |