Make WordPress Core

Changes between Version 2 and Version 3 of Ticket #57131, comment 6


Ignore:
Timestamp:
11/18/2022 12:56:36 AM (2 years ago)
Author:
omaeyusuke
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #57131, comment 6

    v2 v3  
    33
    44> Looking at the other taxonomy functions, including get_the_category_list(), in_category(), the_category(), has_category(), has_term(), etc., it seems like we don't generally include null as an accepted value for the optional $post or $post_id parameter, but we do note "Defaults to the current post".
    5 Yes! IMO $post is required.
     5Yes! IMO $post is required. but, when WordPress uses get_the_terms(), it is implemented with the assumption that it may send a post ID that does not exist.
    66
    77> I'm not quite sure about this change. While technically `$post` can be `null` here, passing the ID explicitly as the current documentation suggests seems more readable and future-proof: