Filter hook 'get_post_status'

in WP Core File wp-includes/post.php at line 1287

View Source

get_post_status

Filter Hook
Description
Filters the post status.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 1287

Hook Parameters

Type Name Description
string $post_status The post status.
WP_Post $post The post object.

Usage Examples

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

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

Source Code Context

wp-includes/post.php:1287 - How this hook is used in WordPress core
<?php
1282  	 * @since 5.7.0 The attachment post type is now passed through this filter.
1283  	 *
1284  	 * @param string  $post_status The post status.
1285  	 * @param WP_Post $post        The post object.
1286  	 */
1287  	return apply_filters( 'get_post_status', $post_status, $post );
1288  }
1289  
1290  /**
1291   * Retrieves all of the WordPress supported post statuses.
1292   *

PHP Documentation

<?php
/**
	 * Filters the post status.
	 *
	 * @since 4.4.0
	 * @since 5.7.0 The attachment post type is now passed through this filter.
	 *
	 * @param string  $post_status The post status.
	 * @param WP_Post $post        The post object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.