[wp-trac] [WordPress Trac] #64104: author-template.php generates PHP Warning with PHP 8.3

WordPress Trac noreply at wordpress.org
Wed Oct 22 21:33:52 UTC 2025


#64104: author-template.php generates PHP Warning with PHP 8.3
--------------------------+--------------------------
 Reporter:  Cornwell      |       Owner:  westonruter
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  6.9
Component:  General       |     Version:  6.8.3
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+--------------------------

Comment (by westonruter):

 @jdahir0789 Your patch [attachment:"64104.patch"] fixes the issue.

 @dhruvang21 I like the idea of your patch [attachment:"fix-64104.patch"]
 in that it adds the `$post_id` parameter similar to `get_the_date()`,
 `get_the_modified_time()`, `get_post_modified_time()`,
 `get_the_modified_author()` function API much more similar to other
 similar functions, like `get_the_time()`, `get_post_time()`,
 `get_post_datetime()`,  and `get_post_timestamp()`. However, your patch
 doesn't actually fix the issue. In this line here:

 {{{#!php
 <?php
 $post_id = $post_id ? $post_id : get_post()->ID;
 }}}

 If there is no global `$post` then `get_post()` will return `null` and the
 same error will occur. However, this can be tweaked

 {{{#!php
 <?php
 $post = get_post( $post );
 if ( ! $post ) {
         return;
 }
 $post_id = $post->ID;
 }}}

 I'll make that change.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64104#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list