Go to file
Boone Gorges 79cfdbd84c Improve querying for terms with falsey names and slugs.
Prior to [38677], `get_term_by()` would always return false if
an empty string were passed as the queried 'name' or 'slug'. The
refactor to use `get_terms()` broke this behavior; inappropriately
imprecise `empty()` checks caused the 'name' or 'slug' clause to be
discarded altogether when fetching terms, resulting in an incorrect
term being returned from the function.

We fix the regression by special-casing truly empty values passed
to `get_term_by()`, and ensuring that `WP_Term_Query` is properly
able to handle `0` and `'0'` term queries.

Props sstoqnov.
Fixes #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@40293 602fd350-edb4-49c9-b593-d223f7449a82
2017-03-16 02:03:53 +00:00
src Improve querying for terms with falsey names and slugs. 2017-03-16 02:03:53 +00:00
tests Improve querying for terms with falsey names and slugs. 2017-03-16 02:03:53 +00:00
tools/i18n DOCS: Replace HTTP links with HTTPS. 2016-06-10 04:49:09 +00:00
.editorconfig Use HTTPS URLs for codex.wordpress.org. 2015-04-12 21:28:58 +00:00
.gitignore Build/Test Tools: Facilitate SVN and Git being co-located in the same directory. 2016-12-12 05:11:27 +00:00
.jshintrc Build/Test Tools: After [29858], update `.jsintrc` to use spaces, not tabs. 2017-01-13 04:44:53 +00:00
.travis.yml Build/Test tools: Don't install PHPUnit on the `travis:js` builds. Saves a couple of minutes of build time. 2017-03-10 23:56:07 +00:00
Gruntfile.js REST API: improve test fixture generation, normalizing data. 2017-02-15 17:58:14 +00:00
package.json Build/Test Tools: Specify exact node version in package.json. 2016-12-04 17:29:26 +00:00
phpunit.xml.dist oEmbed: Remove the oEmbed provider unit tests. 2016-10-20 09:15:10 +00:00
wp-cli.yml Remove debug mode from WP-CLI by default, as it now outputs too much debugging information to be of use during normal development. 2015-11-28 18:36:06 +00:00
wp-config-sample.php Lightly clean up and improve inline documentation in wp-config-sample.php. 2015-05-10 00:05:30 +00:00
wp-tests-config-sample.php Tests: Use a minimal theme for tests. 2016-10-21 11:02:37 +00:00