[wp-trac] [WordPress Trac] #64496: Type Error with gmdate() in dashboard Activity widget
WordPress Trac
noreply at wordpress.org
Tue Jan 13 19:38:49 UTC 2026
#64496: Type Error with gmdate() in dashboard Activity widget
----------------------------+---------------------
Reporter: vanhoucke | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 7.0
Component: Administration | Version: 6.9
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: ui
----------------------------+---------------------
Comment (by sabernhardt):
This probably would be better as a pull request, but the `.diff` was
easier for me.
[attachment:"64496.diff"] treats any non-integer as unreliable and ignores
it in the Activity widget. It uses `is_int()` instead of `is_numeric()`
because I noticed a problem with Simple Location's numeric string. When I
changed a post's published date to 11:34pm yesterday, the widget said the
post was published Today because it was within the GMT offset.
I chose to keep the `<span>` element and leave it empty when it does not
have the timestamp. This does not look good, but removing it might not
look any better. The first element in each list item has a width of 160 to
200 pixels and column gap of 10 pixels.
1. If the `<span>` is empty, that results in 170 to 210 pixels of blank
space.
2. If the `<span>` is removed, the post title link width can be restricted
unnecessarily, but it would be aligned with the "Recently Published"
heading.
3. If `get_the_time( 'U' )` returns a non-integer with one list item, but
not all of them, removing the `<span>` would put that post link in the
same column as dates for the other list items. I changed the output for
only post 1361 by adding the following filter in my must-use plugin:
{{{
add_filter( 'get_the_time', function ( $the_time, $format, $post ) {
if ( isset( $post->ID ) && 1361 === $post->ID ) {
$the_time = 'gotcha';
}
return $the_time;
}, 10, 3 );
}}}
The empty space can also hint that something is amiss without displaying
an error or `_doing_it_wrong` message.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64496#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list