wp_insert_post_empty_content filter-hook . WP 3.3.0
Filters whether the post should be considered "empty".
The post is considered "empty" if both:
- The post type supports the title, editor, and excerpt fields
- The title, editor, and excerpt fields are all empty
Returning a truthy value to the filter will effectively short-circuit the new post being inserted, returning 0. If $wp_error
is true, a WP_Error will be returned instead.
Usage
add_filter( 'wp_insert_post_empty_content', 'filter_function_name_5758', 10, 2 ); function filter_function_name_5758( $maybe_empty, $postarr ){ // filter... return $maybe_empty; }
- $maybe_empty(true/false)
- Whether the post should be considered "empty".
- $postarr(array)
- Array of post data.
Where the hook is called
wp_insert_post_empty_content
wp-includes/post.php 3474
if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
Where the hook is used (in WP core)
wp-includes/class-wp-customize-nav-menus.php 904
add_filter( 'wp_insert_post_empty_content', '__return_false', 1000 );
wp-includes/class-wp-customize-nav-menus.php 906
remove_filter( 'wp_insert_post_empty_content', '__return_false', 1000 );