This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
post_date_column_status filter
Filters the status text of the post.
apply_filters( 'post_date_column_status', string $status, WP_Post $post, string $column_name, string $mode )
Description
This hook is used to filter the status text of a post.
By using this hook, we can get the status of a post with required conditions for any custom post type.
For example, if we want to hide the status for some post type, then we can hide it by using the following code.
function weplugins_hide_status( $status, $post, $column_name, $mode ) { // Get the post type. Replace YOUR_CPT with your CPT slug. if ( $post->post_type == 'YOUR_CPT' ) { return false; } return $status; } add_filter( 'post_date_column_status', 'weplugins_hide_status', 10, 4);
Parameters
- $status : (string) The status text.
- $post : (WP_Post) Post object.
- $column_name : (string) The column name.
- $mode : (string) The list display mode (‘excerpt’ or ‘list’).
Live Examples
Example 1: Basic Hook Usage
To run the hook, copy the example below.
$status = apply_filters( 'post_date_column_status', $status, $post, $date, $mode ); if ( !empty( $status ) ) { // everything has led up to this point... }
Example 2: Adding a Hook Callback
The following example is for adding a hook callback.
add_filter( 'post_date_column_status', 'weplugins_post_date_column_status_filter', 10, 4 ); function weplugins_post_date_column_status_filter( $status, $post, $column_name, $mode ){ // filter... return $status; }
Example 3: Removing a Hook Callback
To remove a hook callback, use the example below.
// remove the filter remove_filter( 'post_date_column_status', 'weplugins_post_date_column_status_filter', 10, 4 );
Contact Us
If you need customization, contact us.
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.