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

How to use post_date_column_time filter in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
July 5, 2022
5 minutes read

post_date_column_time filter

Filters the published time of the post.

apply_filters( 'post_date_column_time', string $t_time, WP_Post $post, string $column_name, string $mode )

Description

This hook is used for filter the published time of a post.

If $mode equals excerpt,, the published time and date are both displayed. If $mode equals list (default), the publish date is displayed, with the time and date together available as an abbreviation definition.

Parameters

  • $t_time : (string) The published time.
  • $post : (WP_Post) Post object.
  • $column_name : (string) The column name.
  • $mode : (string) The list display mode (‘excerpt’ or ‘list’).

Live Example

To run the hook, copy the example below.

$t_time = apply_filters( 'post_date_column_time', $t_time, $post, $date, $mode ); 
                         
if ( !empty( $t_time ) ) { 
                         
   // everything has led up to this point... 
                         
} 
  

The following example is for adding a hook callback.

// define the post_date_column_time callback 
function filter_post_date_column_time( $t_time, $post, $date, $mode ) { 
    // make filter magic happen here... 
    return $t_time; 
}; 
         
// add the filter 
add_filter( 'post_date_column_time', 'filter_post_date_column_time', 10, 4 ); 

To remove a hook callback, use the example below.

// remove the filter 
remove_filter( 'post_date_column_time', 'filter_post_date_column_time', 10, 4 ); 

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.