Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use post_date_column_status filter in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
October 13, 2022
5 minutes read

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 ); 
	

Access Premium WordPress Plugins

Contact Us

If you need customization, contact us.

Sandeep Kumar Mishra

Sandeep Kumar Mishra

Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

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.