• Resolved rwfelty

    (@rwfelty)


    I am attempting to reformat the time in WordPress admin tables and using this code snippet. What am I doing wrong?

    function my_lmt_defaults( $d ) {
    
        $d['contexts']['messages']['timef'] = 'm/j/Y \a\t g:ia';
    
        return $d;
    }
    add_filter('last_modified_timestamp_defaults','my_lmt_defaults');
Viewing 1 replies (of 1 total)
  • Plugin Author Evan Mattson

    (@aaemnnosttv)

    The timestamp is broken into 3 components: date format (datef), time format (timef), and the separator (sep).

    Here it looks like you’re trying to override the whole format with a new date string but you’re only changing the time format. By default, it displays %date% %sep% %time%

    Your filter works but you would want to change it to modify each component like so:

    
    $d['contexts']['messages']['datef'] = 'm/j/Y';
    $d['contexts']['messages']['timef'] = 'g:ia';
    $d['contexts']['messages']['sep'] = 'at';
    

    https://cl.ly/e6334989ead1

Viewing 1 replies (of 1 total)
  • The topic ‘Reformatting WordPress Admin Table Time’ is closed to new replies.