[wp-trac] [WordPress Trac] #39678: get_term_by slug with "0" as value
WordPress Trac
noreply at wordpress.org
Tue Jan 24 15:48:35 UTC 2017
#39678: get_term_by slug with "0" as value
----------------------------+-----------------------------
Reporter: fausonealessio | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.7
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
Executing this code
get_term_by('slug','0','taxonomy_name')
my expectations were to obtain a taxonomy term, considering that one
actually exists in my database, but instead the function returned false
due to the PHP empty function returning true (see
https://core.trac.wordpress.org/browser/tags/4.7/src/wp-
includes/taxonomy.php#L844).
The empty function behaves according to documentation
(http://php.net/manual/en/function.empty.php) but the string "0" should be
accepted to be searched if it is possible to use it to create a taxonomy
term.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39678>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list