[wp-trac] [WordPress Trac] #64864: previous_posts(): PHP 8.1 deprecation notice

WordPress Trac noreply at wordpress.org
Mon Mar 16 05:45:18 UTC 2026


#64864: previous_posts(): PHP 8.1 deprecation notice
------------------------------+----------------------------
 Reporter:  dd32              |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  low               |  Milestone:  Future Release
Component:  Themes            |    Version:
 Severity:  trivial           |   Keywords:  php81
  Focuses:  coding-standards  |
------------------------------+----------------------------
 PHP 8.1 deprecation:
 > ( ! ) Deprecated: ltrim(): Passing null to parameter #1 ($string) of
 type string is deprecated in wp-includes/formatting.php on line 4487

 This is caused by calling `previous_posts( $display = FALSE )`
 [https://developer.wordpress.org/reference/functions/get_previous_posts_page_link/
 devref] on a singular page/post, as done by at
 [https://github.com/Automattic/o2/blob/cfefcda25cc93d14f4edca11aaab1efc3b3e1f60/o2.php#L285-L288
 least one plugin].

 `get_previous_posts_page_link()` returns `null`, which is then passed to
 `esc_url()` in
 [https://developer.wordpress.org/reference/functions/previous_posts/
 prevoous_posts()].

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64864>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list