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
September 18, 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 filtering 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 Examples

Example 1: Basic Hook Usage

To run the hook, you can use the following example:

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

Example 2: Adding a Hook Callback

The following example demonstrates how to add a hook callback:

    // define the post_date_column_time callback 
    function weplugins_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', 'weplugins_filter_post_date_column_time', 10, 4 ); 
    

Example 3: Removing a Hook Callback

To remove a hook callback, use the following example:

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

Access Premium WordPress Plugins

Contact Us

If you need any customization or assistance, feel free to 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.