Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_insert_post_empty_content

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2435      if ( !empty($ID) ) {
2436           $update = true;
2437           $previous_status = get_post_field('post_status', $ID);
2438      } else {
2439           $previous_status = 'new';
2440      }
2441
2442      $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' )
2443           && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' );
2444      if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
2445           if ( $wp_error )
2446                return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
2447           else
2448                return 0;
2449      }
2450
2451      if ( empty($post_type) )
2452           $post_type = 'post';
2453