wp_insert_post_empty_content WordPress Filter Hook

The wp_insert_post_empty_content Wordpress hook allows you to insert a post into the database without any content. This can be useful if you want to create a post that is solely comprised of metadata, or if you want to programmatically generate a post's content.

apply_filters( 'wp_insert_post_empty_content', bool $maybe_empty, array $postarr ) #

Filters whether the post should be considered “empty”.


Description

The post is considered "empty" if both:

  1. The post type supports the title, editor, and excerpt fields
  2. The title, editor, and excerpt fields are all empty

Returning a truthy value from the filter will effectively short-circuit the new post being inserted and return 0. If $wp_error is true, a WP_Error will be returned instead.


Top ↑

Parameters

$maybe_empty

(bool)Whether the post should be considered "empty".

$postarr

(array)Array of post data.


Top ↑

Source

File: wp-includes/post.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More