Commit Graph

863 Commits

Author SHA1 Message Date
Sergey Biryukov 347e831768 Docs: Improve documentation for the `$prev_value` parameter and return result of various metadata update functions.
Props stevenlinx.
Fixes #50502. See #49572.
Built from https://develop.svn.wordpress.org/trunk@48214


git-svn-id: http://core.svn.wordpress.org/trunk@47983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-29 21:22:09 +00:00
Sergey Biryukov 58ad216087 Docs: Improve documentation for optional parameters per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48197


git-svn-id: http://core.svn.wordpress.org/trunk@47966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-28 11:49:02 +00:00
Sergey Biryukov cb9c2ae83f Taxonomy: Make sure `update_object_term_cache()` caches all terms that were not already cached.
Due to an unintended `break` instruction from a previous iteration, the function cached only one term in each taxonomy.

Follow-up to [48055].

Props Chouby.
Fixes #50352.
Built from https://develop.svn.wordpress.org/trunk@48187


git-svn-id: http://core.svn.wordpress.org/trunk@47956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-26 22:31:08 +00:00
Sergey Biryukov b16368c268 Docs: Remove `@staticvar` tags from core.
The tag was supported in phpDocumentor 1.x, but is no longer supported in 2.x and 3.x.

Usage of static variables is considered an internal implementation detail and has no information value for someone reading the docs.

Props alishanvr, jrf.
Fixes #50426.
Built from https://develop.svn.wordpress.org/trunk@48109


git-svn-id: http://core.svn.wordpress.org/trunk@47878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:40:12 +00:00
Sergey Biryukov e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
Sergey Biryukov a8cd3a3e2c Coding Standards: Rename the `$clean` or `$ids` variable in several functions to `$non_cached_ids` for clarity.
* `_get_non_cached_ids()`
* `update_meta_cache()`
* `update_object_term_cache()`

See #49542.
Built from https://develop.svn.wordpress.org/trunk@48065


git-svn-id: http://core.svn.wordpress.org/trunk@47832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 19:09:08 +00:00
whyisjake 8a6cc1a810 Cache API: Add `wp_cache_get_multiple()` to core functions.
* `update_object_term_cache`
* `update_meta_cache`
* `_get_non_cached_ids`

See [47938].

Fixes #50352.

Props spacedmonkey, tillkruss, lukecavanagh. 


Built from https://develop.svn.wordpress.org/trunk@48055


git-svn-id: http://core.svn.wordpress.org/trunk@47822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 06:30:09 +00:00
Sergey Biryukov 40584118d9 Docs: Document that `get_tags()` returns a `WP_Error` object if any of the specified taxonomies do not exist.
Props coffee2code.
Fixes #50344.
Built from https://develop.svn.wordpress.org/trunk@47930


git-svn-id: http://core.svn.wordpress.org/trunk@47703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-09 11:14:12 +00:00
Sergey Biryukov 5f47ca5b8b Docs: Adjust the documentation for the new `ID` alias in `get_term_by()` for consistency with `get_user_by()`.
Follow-up to [47865].

See #45163.
Built from https://develop.svn.wordpress.org/trunk@47870


git-svn-id: http://core.svn.wordpress.org/trunk@47645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-31 19:53:04 +00:00
whyisjake 7798f64340 Taxonomy: Extend `get_term_by` to accept `ID` as a term parameter.
Similar to `get_user_by`, both `ID` and `id` should be able to accepted.

Fixes #45163.
Props emrikol, esoj.
 

Built from https://develop.svn.wordpress.org/trunk@47865


git-svn-id: http://core.svn.wordpress.org/trunk@47641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-29 22:43:09 +00:00
Sergey Biryukov 427405535f Docs: Synchronize parameter documentation for various metadata functions, update per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@47611


git-svn-id: http://core.svn.wordpress.org/trunk@47386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-22 10:31:09 +00:00
Sergey Biryukov 9aa0fff80e Docs: Document the default value of `$single` and `$prev_value` parameters in various metadata functions.
Props denisco.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@47610


git-svn-id: http://core.svn.wordpress.org/trunk@47385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-22 09:40:10 +00:00
Sergey Biryukov a21b8a91c6 Docs: Add a `@since` note for un-deprecated `category_link` and `tag_link` filters.
Follow-up to [47576].

See #49759.
Built from https://develop.svn.wordpress.org/trunk@47578


git-svn-id: http://core.svn.wordpress.org/trunk@47353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-14 08:15:19 +00:00
whyisjake 0a714eb26f Taxonomy: Un-depracate `category_link` and `tag_link` filters.
Depracating these filter might have been an accident, so let's restore.

Props SergeyBiryukov, audrasjb, peterwilsoncc.
Fixes #49759. 

Built from https://develop.svn.wordpress.org/trunk@47576


git-svn-id: http://core.svn.wordpress.org/trunk@47351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-14 00:33:09 +00:00
Sergey Biryukov 856e1a27b8 Coding Standards: Use strict type check for `in_array()` and `array_search()`.
This addresses all the remaining `WordPress.PHP.StrictInArray.MissingTrueStrict` issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47557


git-svn-id: http://core.svn.wordpress.org/trunk@47332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-09 15:43:10 +00:00
Sergey Biryukov 38676936ba Coding Standards: Use strict type check for `in_array()` and `array_search()` where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
Sergey Biryukov 641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
John Blackbourn 71f099fdb0 Taxonomy: Clarify the docs for the return values of the `term_exists()` function.
Props dotancohen, sathyapulse

Fixes #43345
Built from https://develop.svn.wordpress.org/trunk@47205


git-svn-id: http://core.svn.wordpress.org/trunk@47005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-07 17:48:09 +00:00
Sergey Biryukov fa0563c877 Docs: Add a `@since` note for [47186].
See #48558.
Built from https://develop.svn.wordpress.org/trunk@47187


git-svn-id: http://core.svn.wordpress.org/trunk@46987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-05 06:33:04 +00:00
Sergey Biryukov 4f422b028d Taxonomy: In `register_taxonomy()`, return the registered taxonomy object on success, for consistency with `register_post_type()`.
Props krynes, SergeyBiryukov.
Fixes #48558.
Built from https://develop.svn.wordpress.org/trunk@47186


git-svn-id: http://core.svn.wordpress.org/trunk@46986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-05 06:26:06 +00:00
Sergey Biryukov 001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov 396647666f Docs: Various documentation fixes for unit test factories.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46985


git-svn-id: http://core.svn.wordpress.org/trunk@46785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-18 00:19:02 +00:00
John Blackbourn f93ee2ca76 Docs: Increase the specificity of various docblock parameter types and return types.
See #48303
Built from https://develop.svn.wordpress.org/trunk@46823


git-svn-id: http://core.svn.wordpress.org/trunk@46623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-06 22:43:04 +00:00
Sergey Biryukov 3d623995a8 Docs: In various `@return` tags, list the expected type first, instead of `WP_Error`.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46696


git-svn-id: http://core.svn.wordpress.org/trunk@46496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-11 02:43:03 +00:00
Sergey Biryukov 1f816ad18d Docs: Use the `{@see ...}` tag for the replacement in `@deprecated` tags, so that Developer Reference could automatically link to the replacement.
Props jrf.
See #48255.
Built from https://develop.svn.wordpress.org/trunk@46685


git-svn-id: http://core.svn.wordpress.org/trunk@46485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-09 13:05:02 +00:00
Sergey Biryukov f60094679f Coding Standards: Consistently use `do_action_deprecated()` and `apply_filters_deprecated()` for deprecated hooks.
Props jrf.
See #48255.
Built from https://develop.svn.wordpress.org/trunk@46684


git-svn-id: http://core.svn.wordpress.org/trunk@46484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-09 12:59:03 +00:00
John Blackbourn f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46660


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn 3caaa40fc6 Docs: Switch more docs over to typed array notation, plus some fixes.
See #48303, #41756

Built from https://develop.svn.wordpress.org/trunk@46596


git-svn-id: http://core.svn.wordpress.org/trunk@46393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:09:04 +00:00
John Blackbourn 2f46afbc53 Docs: Miscellaneous inline docs corrections and improvements.
See #47110 

Built from https://develop.svn.wordpress.org/trunk@46424


git-svn-id: http://core.svn.wordpress.org/trunk@46222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-07 19:08:06 +00:00
John Blackbourn e36d1bcbd8 Docs: Docblock corrections and improvements, mostly related to various `pre_*` filters.
See #47110

Built from https://develop.svn.wordpress.org/trunk@46232


git-svn-id: http://core.svn.wordpress.org/trunk@46044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-21 17:41:57 +00:00
Sergey Biryukov 6354f6dcdc Docs: Clarify that `$show_in_rest` parameter of `register_post_type()` and `register_taxonomy()` should be enabled for the post type or taxonomy to be available in the block editor.
Props ramon-fincken.
Fixes #48084.
Built from https://develop.svn.wordpress.org/trunk@46196


git-svn-id: http://core.svn.wordpress.org/trunk@46008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-20 13:05:57 +00:00
Sergey Biryukov e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
John Blackbourn 640c90d35d Docs: Correct and improve inline docs relating to caching, terms, meta, and some misc tweaks.
See #47110   

Built from https://develop.svn.wordpress.org/trunk@45915


git-svn-id: http://core.svn.wordpress.org/trunk@45726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-30 11:36:08 +00:00
Boone Gorges e0c83d76d1 Taxonomy: Fix unique-slug check for terms with parents.
`wp_unique_term_slug()` appends numeric suffixes when the requested slug is
already in use by a sibling term. Changes introduced in [32837] inadvertently
caused this suffixing to be skipped in cases where the requested slug is
suffixed with the parent slug, so that it became possible to have two terms
`childslug-parentslug` underneath to the same `parentslug`. We fix this
regression by ensuring that the numeric-suffix routine runs in all cases.

Props yashar_hv, saskak, dlh.
Fixes #46431.
Built from https://develop.svn.wordpress.org/trunk@45893


git-svn-id: http://core.svn.wordpress.org/trunk@45704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-26 15:19:56 +00:00
Sergey Biryukov 36b4debdb4 Docs: Correct type for the `$deprecated` argument of `get_terms()`.
Props itowhid06.
Fixes #47915.
Built from https://develop.svn.wordpress.org/trunk@45872


git-svn-id: http://core.svn.wordpress.org/trunk@45683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-21 16:27:55 +00:00
Sergey Biryukov 0e1343ee2b Docs: Correct type for `query_var` argument of `register_taxonomy()`.
Props juiiee8487, audrasjb.
Fixes #47877.
Built from https://develop.svn.wordpress.org/trunk@45797


git-svn-id: http://core.svn.wordpress.org/trunk@45608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-14 17:47:55 +00:00
Sergey Biryukov b1e34ccc1f Docs: Add missing description for `$wp_rewrite` global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45735


git-svn-id: http://core.svn.wordpress.org/trunk@45546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:19:56 +00:00
Sergey Biryukov 29b072e706 Docs: Add missing description for `$wpdb`, `$wp_db_version`, and `$wp_current_db_version` globals.
Props mukesh27, utsav72640, immeet94, SergeyBiryukov.
See #45604.
Built from https://develop.svn.wordpress.org/trunk@45734


git-svn-id: http://core.svn.wordpress.org/trunk@45545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:12:56 +00:00
Sergey Biryukov c26f1c5d90 Taxonomy: Fix deprecated calls to `get_terms()`.
The taxonomy should be passed as part of `$args`, rather than as its own argument.

Props sgastard, mukesh27, SergeyBiryukov.
Fixes #47819.
Built from https://develop.svn.wordpress.org/trunk@45723


git-svn-id: http://core.svn.wordpress.org/trunk@45534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-03 03:35:56 +00:00
Sergey Biryukov 6623a824d0 Taxonomy: Correct some strict comparisons after [45710].
See #47573.
Built from https://develop.svn.wordpress.org/trunk@45711


git-svn-id: http://core.svn.wordpress.org/trunk@45522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-01 15:04:56 +00:00
Sergey Biryukov 3e1126d940 Coding Standards: Use strict comparison in `wp-includes/taxonomy.php`.
Props andizer, SergeyBiryukov.
Fixes #47573.
Built from https://develop.svn.wordpress.org/trunk@45710


git-svn-id: http://core.svn.wordpress.org/trunk@45521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-01 13:45:56 +00:00
Sergey Biryukov 383c1df66b Docs: Correct `@return` value description for `get_term_link()`.
Props garrett-eclipse.
Fixes #47806.
Built from https://develop.svn.wordpress.org/trunk@45702


git-svn-id: http://core.svn.wordpress.org/trunk@45513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-31 01:19:56 +00:00
Sergey Biryukov 18bd01985b Coding Standards: Rename `$r` variable used with `wp_parse_args()` to `$parsed_args` for clarity.
Props freewebmentor.
Fixes #45059.
Built from https://develop.svn.wordpress.org/trunk@45667


git-svn-id: http://core.svn.wordpress.org/trunk@45478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 00:48:58 +00:00
Gary Pendergast 14c7533162 Coding Standards: Fix all `WordPress.DB.PreparedSQLPlaceholders` issues.
See #47632.


Built from https://develop.svn.wordpress.org/trunk@45603


git-svn-id: http://core.svn.wordpress.org/trunk@45414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-05 05:43:55 +00:00
Gary Pendergast 4803fc405e Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `wp-includes`.
See #47632.


Built from https://develop.svn.wordpress.org/trunk@45590


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Sergey Biryukov f29eba6662 Taxonomy: In `wp_insert_term()`, handle an error if writing to the `term_taxonomy` table fails.
This complements the check for successful writing to the `terms` table, added in [7430].

Props mbabker.
Fixes #47313.
Built from https://develop.svn.wordpress.org/trunk@45362


git-svn-id: http://core.svn.wordpress.org/trunk@45173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-17 22:28:51 +00:00
desrosj 03240dd3f4 Docs: Correct various spelling mistakes.
Props man4toman.
Fixes #46339.
Built from https://develop.svn.wordpress.org/trunk@44894


git-svn-id: http://core.svn.wordpress.org/trunk@44725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-13 19:32:53 +00:00
Boone Gorges b44877f0da Taxonomy: Remove `@ignore` annotation on `_get_term_hierarchy()`.
Originally introduced in [32453], the `@ignore` annotation caused the
function to be improperly ignored by the Code Reference parser.

The `@access private` annotation is the correct way to mark a
function for internal use only.

Props coffee2code.
Fixes #45997.
Built from https://develop.svn.wordpress.org/trunk@44755


git-svn-id: http://core.svn.wordpress.org/trunk@44587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-02-19 20:24:50 +00:00
Boone Gorges 811be4779e Taxonomy: Update `@since` annotations for `meta_box_sanitize_cb` arg.
Introduced in [42211].

Fixes #36514.
Built from https://develop.svn.wordpress.org/trunk@44519


git-svn-id: http://core.svn.wordpress.org/trunk@44350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-09 15:11:48 +00:00
Gary Pendergast 170b03ab19 Docs: Update `@since` for `is_taxonomy_viewable()`.
Props andizer.
Fixes #44466.


Built from https://develop.svn.wordpress.org/trunk@44447


git-svn-id: http://core.svn.wordpress.org/trunk@44278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 03:11:50 +00:00
Boone Gorges 7a6764679f Update `since` annotation for `wp_insert_term_duplicate_check` filter.
Originally added in [43570].

Props audrasjb.
Fixes #43271.
Built from https://develop.svn.wordpress.org/trunk@44372


git-svn-id: http://core.svn.wordpress.org/trunk@44202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-28 23:31:50 +00:00
Boone Gorges 88ccca5d76 Ensure that taxonomy name passed to `get_term()` filters is non-empty.
Since [34997], the `$taxonomy` parameter of `get_term()` has been
optional. This created cases where the `$taxonomy` parameter, used
to concatenate names for some filters and passed as a parameter to
others, would be empty. This changeset ensures that it's never
empty by falling back on the `taxonomy` of the located term.

Props dlh.
Fixes #45698.
Built from https://develop.svn.wordpress.org/trunk@44325


git-svn-id: http://core.svn.wordpress.org/trunk@44155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 03:48:48 +00:00
Boone Gorges 8b95b0faf2 Update `@since` tag on taxonomy hooks to be introduced in 5.1.0.
The hooks were added in [43558] but pulled from the 4.9.x and 5.0.x series.

Fixes #44733.
Built from https://develop.svn.wordpress.org/trunk@44321


git-svn-id: http://core.svn.wordpress.org/trunk@44151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 03:37:15 +00:00
Jeremy Felt 2dce718157 REST API: Move object type-specific metadata integrations from the wrapper functions to the low-level Meta API functions.
Object type-specific actions that should happen before or after modification of metadata have so far been part of the respective wrapper functions. By using action and filter hooks, this changeset ensures they are always executed, even when calling the lower-level Meta API functions directly, which the REST API does as a prime example.

Merges [43729] to trunk.

Props flixos90, spacedmonkey.
Fixes #44467.

Built from https://develop.svn.wordpress.org/trunk@43982


git-svn-id: http://core.svn.wordpress.org/trunk@43814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-12 03:02:24 +00:00
Sergey Biryukov c0aa2239a8 Docs: Update `@since` version for `(un)registered_taxonomy_for_object_type` actions introduced in [43558].
See #44733.
Built from https://develop.svn.wordpress.org/trunk@43631


git-svn-id: http://core.svn.wordpress.org/trunk@43460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-09-06 07:49:24 +00:00
Gary Pendergast 56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


Built from https://develop.svn.wordpress.org/trunk@43571


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Boone Gorges 8142df82bc Introduce `wp_insert_term_duplicate_term_check` filter.
This filter allows plugins to intervene in the duplicate-term check
that takes place at the time of term creation. See [30238], #22023.

Props strategio.
Fixes #43271.
Built from https://develop.svn.wordpress.org/trunk@43570


git-svn-id: http://core.svn.wordpress.org/trunk@43399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-15 19:50:25 +00:00
Boone Gorges 297c7e4c8f Taxonomy: Introduce new hooks when registering/unregistering taxonomies for object types.
Props soulseekah.
Fixes #44733.
Built from https://develop.svn.wordpress.org/trunk@43558


git-svn-id: http://core.svn.wordpress.org/trunk@43387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-08 19:15:27 +00:00
K. Adam White a7735117b6 Docs: Update @since version to 4.9.8 for meta registration subtype handling.
This feature has been backported to 4.9.8 so 5.0.0 is inaccurate.

See #38323.

Built from https://develop.svn.wordpress.org/trunk@43520


git-svn-id: http://core.svn.wordpress.org/trunk@43349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-23 17:02:25 +00:00
Felix Arntz b76a714bba Taxonomy: Introduce `is_taxonomy_viewable()`.
This utility function allows for easy detection whether terms for a taxonomy are considered publicly viewable.

Props andizer.
Fixes #44466.

Built from https://develop.svn.wordpress.org/trunk@43386


git-svn-id: http://core.svn.wordpress.org/trunk@43214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-03 10:29:28 +00:00
K. Adam White a89c86c711 REST API: Support meta registration for specific object subtypes.
Introduce an `object_subtype` argument to the args array for `register_meta()` which can be used to limit meta registration to a single subtype (e.g. a custom post type or taxonomy, vs all posts or taxonomies).

Introduce `register_post_meta()` and `register_term_meta()` wrapper methods for `register_meta` to provide a convenient interface for the common case of registering meta for a specific taxonomy or post type. These methods work the way plugin developers have often expected `register_meta` to function, and should be used in place of direct `register_meta` where possible.

Props flixos90, tharsheblows, spacedmonkey.
Fixes #38323.


Built from https://develop.svn.wordpress.org/trunk@43378


git-svn-id: http://core.svn.wordpress.org/trunk@43206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:43:21 +00:00
John Blackbourn 8b34c79cec Docs: Update and correct various inline documentation.
See #42505, #41756

Built from https://develop.svn.wordpress.org/trunk@43177


git-svn-id: http://core.svn.wordpress.org/trunk@43006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-07 17:20:22 +00:00
John Blackbourn 1b5d6c6971 Docs: Document many more parameters and properties using typed array notation.
See #41756

Built from https://develop.svn.wordpress.org/trunk@42871


git-svn-id: http://core.svn.wordpress.org/trunk@42701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-22 20:27:32 +00:00
Dominik Schilling 5c291d49de Pinking shears.
See #41057.
Built from https://develop.svn.wordpress.org/trunk@42843


git-svn-id: http://core.svn.wordpress.org/trunk@42673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-18 14:23:33 +00:00
Sergey Biryukov 4848a09b35 I18N: Use the actual placeholder instead of a number in translator comments if the corresponding string does not use numbered placeholders.
Add missing translator comments in `WP_Theme_Install_List_Table` and `wp_notify_postauthor()`.
Add missing commas in some translator comments.

Fixes #43523.
Built from https://develop.svn.wordpress.org/trunk@42827


git-svn-id: http://core.svn.wordpress.org/trunk@42657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-11 16:44:34 +00:00
Sergey Biryukov 9cb07ec40e Taxonomy: Make the "Format" taxonomy name plural, for consistency with other taxonomies.
Props afercia, danieltj.
Fixes #43370.
Built from https://develop.svn.wordpress.org/trunk@42755


git-svn-id: http://core.svn.wordpress.org/trunk@42585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-26 18:22:31 +00:00
Drew Jaynes 6e665d1f15 Docs: Link to the "Conditional Tags" article in the Theme Developer Handbook from the descriptions for a variety of core conditional tag functions.
These notations largely serve to direct consumers (of both the source and the parsed code reference) to extended information on individual and related conditional tags throughout WordPress. The changeset also standardizes corresponding DocBlock summaries to use third-person singular verbs.

Notations been added for the following functions:

* comments_open()
* email exists()
* has_excerpt()
* has_post_thumbnail()
* has_tag()
* in_category()
* in_the_loop()
* is_404()
* is_active_sidebar()
* is_active_widget()
* is_admin()
* is_admin_bar_showing()
* is_archive()
* is_attachment()
* is_author()
* is_blog_installed()
* is_category()
* is_comments_popup()
* is_date()
* is_day()
* is_dynamic_sidebar()
* is_feed()
* is_front_page()
* is_home()
* is_local_attachment()
* is_main_query
* is_month()
* is_multi_author
* is_new_day()
* is_page()
* is_page_template()
* is_paged()
* is_plugin_active()
* is_plugin_active_for_network()
* is_plugin_inactive()
* is_plugin_page()
* is_post_type_archive()
* is_preview()
* is_rtl()
* is_search()
* is_single()
* is_singular()
* is_sticky()
* is_tag()
* is_tax()
* is_taxonomy_hierarchical()
* is_time()
* is_trackback()
* is_user_logged_in()
* is_year()
* pings_open()
* post_type_exists()
* taxonomy_exists()
* term_exists()
* username exists()
* wp_attachment_is_image()
* wp_script_is()

Props janalwin.
Fixes #43254.

Built from https://develop.svn.wordpress.org/trunk@42710


git-svn-id: http://core.svn.wordpress.org/trunk@42538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-13 16:54:31 +00:00
Sergey Biryukov e1e041271e Docs: Fix typo in `term_exists()` DocBlock.
Props milana_cap, danieltj.
Fixes #43268.
Built from https://develop.svn.wordpress.org/trunk@42699


git-svn-id: http://core.svn.wordpress.org/trunk@42527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-11 17:16:29 +00:00
John Blackbourn 91464bce65 Docs: Add missing code formatting to various `@since` entries.
See #42505

Built from https://develop.svn.wordpress.org/trunk@42678


git-svn-id: http://core.svn.wordpress.org/trunk@42506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-09 16:55:31 +00:00
Peter Wilson 8f0ab2efb8 Taxonomy: Stop warming term meta cache unnecessarily.
Prevent several core function calls to `get_terms()` from warming the term meta cache.

Props peterwilsoncc, boonebgorges, jrf.
Fixes #43142.


Built from https://develop.svn.wordpress.org/trunk@42649


git-svn-id: http://core.svn.wordpress.org/trunk@42478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-05 04:10:30 +00:00
Gary Pendergast aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Boone Gorges 2322b40358 Introduce `meta_box_sanitize_cb` taxonomy argument.
The `meta_box_cb` argument was introduced in [25572] to allow plugin
authors to provide a custom callback for rendering their taxonomy's meta
box on the post edit screen. However, the routine used to handle the saving
of these custom taxonomy meta boxes was not customizable, but was instead
based simply on whether the taxonomy was hierarchicaly. See [13535].

The new `meta_box_sanitize_cb` argument defaults to the "tag" routine for
non-hierarchical taxonomies and the "category" routine for hierarchical ones,
thereby maintaining the current default behavior. Developers can override this
when the data passed from their `meta_box_cb` differs.

Props boonebgorges, ZaneMatthew, stephenharris.
Fixes #36514.
Built from https://develop.svn.wordpress.org/trunk@42211


git-svn-id: http://core.svn.wordpress.org/trunk@42040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-21 03:15:50 +00:00
Sergey Biryukov 654386a5b7 Taxonomy: After [40984], add the `most_used` label for non-hierarchical taxonomies too, and use it on the Menus screen.
Props johnbillion.
Fixes #41150.
Built from https://develop.svn.wordpress.org/trunk@41987


git-svn-id: http://core.svn.wordpress.org/trunk@41821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-24 11:23:24 +00:00
Boone Gorges 8d773262f3 Taxonomy: Don't discard keys when merging queried terms from different taxonomies.
For values of `fields` like `id=>parent`, the keys of the array must be
maintained as part of the query results.

Introduced as part of #40496. See [38667], [40513].

Props miyauchi, dany2217, pcarvalho.
Fixes #41293.
Built from https://develop.svn.wordpress.org/trunk@41809


git-svn-id: http://core.svn.wordpress.org/trunk@41643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-10 16:45:48 +00:00
John Blackbourn 4a16295dc5 Docs: Standardise the format used for documenting parameters passed by reference.
See #35974, #41017

Built from https://develop.svn.wordpress.org/trunk@41688


git-svn-id: http://core.svn.wordpress.org/trunk@41522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:14:46 +00:00
Andrea Fercia a42b9cebde Quick/Bulk Edit: Improve the inline error messages styling.
- uses the core `notice` styles for the Quick Edit form inline error messages
- adds missing periods at the end of a few error messages

Props ocean90, karmatosed, melchoyce, afercia.
Fixes #35496.

Built from https://develop.svn.wordpress.org/trunk@41684


git-svn-id: http://core.svn.wordpress.org/trunk@41518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 21:52:52 +00:00
John Blackbourn acaf286151 Taxonomy: Add context and a translator comment to the new `most_used` label.
Fixes #41150

Built from https://develop.svn.wordpress.org/trunk@41674


git-svn-id: http://core.svn.wordpress.org/trunk@41508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 18:25:46 +00:00
Gary Pendergast 0028a9555e Database: Don't quote placeholders in queries going through `$wpdb->prepare()`
To bring Core into line with the changes to `$wpdb->prepare()` in WordPress 4.8.2, query placeholders shouldn't be quoted.

Props jrf, johnjamesjacoby.
Fixes #41983.


Built from https://develop.svn.wordpress.org/trunk@41628


git-svn-id: http://core.svn.wordpress.org/trunk@41463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-28 04:32:46 +00:00
John Blackbourn 2429d4acea Taxonomy: Introduce a `back_to_items` taxonomy label.
This is used after updating a taxonomy term in the link to return to the term listing screen.

Props benoitchantre

Fixes #41898

Built from https://develop.svn.wordpress.org/trunk@41618


git-svn-id: http://core.svn.wordpress.org/trunk@41453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-27 14:39:45 +00:00
Dominik Schilling fff02086dd Taxonomy: Remove unused global imports for `$wpdb` in `get_terms()` and `wp_get_object_terms()`.
Also remove incorrect `@global` tags for `$wpdb` and `$wp_filter`.

Fixes #41768.
Built from https://develop.svn.wordpress.org/trunk@41326


git-svn-id: http://core.svn.wordpress.org/trunk@41157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-31 12:26:42 +00:00
Drew Jaynes abf8e91521 Docs: Add a note to the `register_taxonomy()` DocBlock that the object types defined in `$object_type` when modifying an already-registered taxonomy will be overwritten.
Props danielbachhuber and BjornW for the initial patches.
Fixes #34413.

Built from https://develop.svn.wordpress.org/trunk@41280


git-svn-id: http://core.svn.wordpress.org/trunk@41120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-20 19:23:47 +00:00
Sergey Biryukov dd330359eb Docs: Correct `@param` type for `$term_id` in `get_term_children()`.
Props Soean, wido.
Fixes #41585.
Built from https://develop.svn.wordpress.org/trunk@41235


git-svn-id: http://core.svn.wordpress.org/trunk@41075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-08 20:53:46 +00:00
Boone Gorges 42ac7e7e13 Taxonomy: Introduce `pre_term_link` filter.
This filter allows developers to filter the taxonomy permalink
structure before a term's permalink is generated. It parallels
the 'pre_post_link' filter for the 'post' post type.

Props nikeo.
Fixes #39601.
Built from https://develop.svn.wordpress.org/trunk@41191


git-svn-id: http://core.svn.wordpress.org/trunk@41031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-30 15:10:44 +00:00
Boone Gorges 65e2935636 Taxonomy: Avoid duplicates when querying for terms in taxonomies registered with `$args` parameter.
[40514] introduced a bug that caused term queries to return some duplicates
when the `$taxonomies` array contained only taxonomies that were originally
registered with an `$args` array. We fix this bug by ensuring that
recursive `get_terms()` queries stop when all queried `$taxonomies` have
already been referenced.

Props bor0, atanasangelovdev.
Fixes #41010.
Built from https://develop.svn.wordpress.org/trunk@41037


git-svn-id: http://core.svn.wordpress.org/trunk@40887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-13 13:41:44 +00:00
Boone Gorges dc35b759be Introduce `wp_get_object_terms_args` filter.
This filter allows developers to modify the arguments passed to
`wp_get_object_terms()` before the query is run.

Props enrico.sorcinelli.
Fixes #35925.
Built from https://develop.svn.wordpress.org/trunk@40994


git-svn-id: http://core.svn.wordpress.org/trunk@40844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-02 18:29:42 +00:00
Boone Gorges 26fcea496d Introduce `most_used` taxonomy label, for text on 'Most Used' metabox tab.
Props mdifelice, jlambe.
Fixes #41150.
Built from https://develop.svn.wordpress.org/trunk@40984


git-svn-id: http://core.svn.wordpress.org/trunk@40834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 14:46:41 +00:00
Drew Jaynes 22f76adc8c Docs: Add full documentation for members in the labels object returned by get_taxonomy_labels().
Props truongwp.
Fixes #41108.

Built from https://develop.svn.wordpress.org/trunk@40944


git-svn-id: http://core.svn.wordpress.org/trunk@40794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-25 21:42:43 +00:00
Boone Gorges 2ebc1fb143 Cache results in `get_objects_in_term()`.
This helps to reduce database queries when generating nav menus.

Props spacedmonkey.
Fixes #37094.
Built from https://develop.svn.wordpress.org/trunk@40921


git-svn-id: http://core.svn.wordpress.org/trunk@40771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-22 03:19:44 +00:00
Boone Gorges 8ca91024e8 Improve cache invalidation when splitting shared terms.
This changeset addresses two related issues:

* When splitting shared terms from hierarchical taxonomies, the process of regenerating the taxonomy hierarchy (`_get_taxonomy_hierarchy()`) requires recursive calls to `get_terms()` in order to descend the tree. By waiting until all shared terms in a term group have been invalidated before regenerating their taxonomy hierarchies, we avoid certain race conditions.
* Previously, a coding error prevented single-term caches from being invalidated for children of split terms. This error dates from [31418].

See #37189.
Built from https://develop.svn.wordpress.org/trunk@40920


git-svn-id: http://core.svn.wordpress.org/trunk@40770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-21 04:12:44 +00:00
Boone Gorges 989427d598 Introduce `clean_taxonomy_cache()` function.
Previously, taxonomy-wide caches were cleaned only inside of
`clean_term_cache()`. This made it hard to clean taxonmy caches
in isolation from specific taxonomy terms.

Props spacedmonkey.
See #37189.
Built from https://develop.svn.wordpress.org/trunk@40919


git-svn-id: http://core.svn.wordpress.org/trunk@40769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-21 04:04:41 +00:00
Sergey Biryukov 3a190792ba Docs: Add missing `@param` and `@return` descriptions for `has_term_meta()`, `wp_delete_category()`, and `wp_term_is_shared()`.
Props keesiemeijer.
Fixes #41096.
Built from https://develop.svn.wordpress.org/trunk@40917


git-svn-id: http://core.svn.wordpress.org/trunk@40767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-20 18:28:46 +00:00
Boone Gorges 92175dbd33 Add term meta support to XML-RPC `addTerm` and `editTerm` endpoints.
This changeset also includes the new function `has_term_meta()`, a
counterpart to `has_meta()` (for posts).

Props enrico.sorcinelli.
Fixes #35991.
Built from https://develop.svn.wordpress.org/trunk@40916


git-svn-id: http://core.svn.wordpress.org/trunk@40766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-18 10:40:46 +00:00
Boone Gorges e45ee36b84 Restore support for taxonomy 'args' override when querying object terms.
[7520] introduced an undocumented feature whereby developers could
register a custom taxonomy with an 'args' parameter, consisting of
an array of config params that, when present, override corresponding
params in the `$args` array passed to `wp_get_object_terms()` when
using that function to query for terms in the specified taxonomy.

The `wp_get_object_terms()` refactor in [38667] failed to respect
this secret covenant, and the current changeset atones for the
transgression.

Props danielbachhuber.
Fixes #40496.
Built from https://develop.svn.wordpress.org/trunk@40513


git-svn-id: http://core.svn.wordpress.org/trunk@40389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-21 19:14:44 +00:00
Boone Gorges 7102240efe Invalidate term query caches when setting or deleting term relationships.
Prior to 4.7, term relationships - as set by `wp_set_object_terms()` or
`wp_remove_object_terms()` - did not affect the term query cache. The
introduction of the 'object_ids' parameter in 4.7 means that the query
cache must be aware of object-term relationships. As such, the
'last_changed' incrementor is now invalidated when term relationships
are modified.

This bug only reared its head when delaying term counting, because term
counting performs its own term query cache invalidation.

Props mboynes.
Fixes #40306.
Built from https://develop.svn.wordpress.org/trunk@40353


git-svn-id: http://core.svn.wordpress.org/trunk@40260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-30 16:51:47 +00:00
Drew Jaynes c1030f3b94 Docs: Add a missing return description for `get_post_taxonomies()`.
h/t deeptiboddapati.
See #39130.

Built from https://develop.svn.wordpress.org/trunk@40298


git-svn-id: http://core.svn.wordpress.org/trunk@40205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-17 17:27:41 +00:00
Boone Gorges 72e14046c7 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.
Built from https://develop.svn.wordpress.org/trunk@40293


git-svn-id: http://core.svn.wordpress.org/trunk@40200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-16 02:04:43 +00:00
Boone Gorges 1e05730f2d Streamline `get_terms()` parameter documentation.
Since 4.6, `get_terms()` has been a wrapper for `WP_Term_Query`.
Full parameter documentation lives with the class, and
`get_terms()` should reference rather than duplicate it.

Props shashwatmittal.
Fixes #37075.
Built from https://develop.svn.wordpress.org/trunk@40292


git-svn-id: http://core.svn.wordpress.org/trunk@40199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-16 01:35:45 +00:00
Boone Gorges d4350bc065 Fix the formatting of `$taxonomies` parameter of `'wp_get_object_terms'` filter.
[38667] changed the way that the filter parameters are built. That
changeset didn't fully account for the pre-4.7 format of `$taxonomies`.

Props ig_communitysites.
Fixes #40154.
Built from https://develop.svn.wordpress.org/trunk@40290


git-svn-id: http://core.svn.wordpress.org/trunk@40197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-14 18:42:43 +00:00
Boone Gorges bdd898045d Don't run 'get_terms' filter when querying for terms within `get_term_by()`.
Historically, it has been possible to call `get_term_by()` within
a 'get_terms' filter callback. Since `get_term_by()` was refactored
to use `get_terms()` internally [38677], callbacks of this nature
have resulted in infinite loops.

As a workaround, we introduce a 'suppress_filter' option to `get_terms()`,
and use it when calling the function from within `get_term_by()`.

Props ocean90.
See #21760.
Built from https://develop.svn.wordpress.org/trunk@40275


git-svn-id: http://core.svn.wordpress.org/trunk@40192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-11 02:27:44 +00:00
Boone Gorges ac6a3c76e4 Taxonomy: Take 'parent' into account when checking for terms with duplicate names.
Terms with duplicate names are not allowed at the same level of a
taxonomy hierarchy. The name lookup introduced in [34809] did not
properly account for the 'parent' parameter, with the result that
the duplicate-name restriction was tighter than intended (terms
with duplicate names could not be created at different levels of
a single hierarchy).

Props mikejolley.
Fixes #39984.
Built from https://develop.svn.wordpress.org/trunk@40145


git-svn-id: http://core.svn.wordpress.org/trunk@40084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-03 02:50:41 +00:00