Commit Graph

309 Commits

Author SHA1 Message Date
Boone Gorges
699025a785 Taxonomy: Restore deprecated argument to term_description() signature.
This ensures that the parameter can't be reused for something else
in the future.

Props jorbin.
Fixes #42605.
Built from https://develop.svn.wordpress.org/trunk@42417


git-svn-id: http://core.svn.wordpress.org/trunk@42248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-22 02:48:51 +00:00
Boone Gorges
39c7daf7db category_description() should be taxonomy-agnostic.
This change reinstates the previous de facto behavior of `category_description()`.
See [40979], [42364]. Because `term_description()` no longer passes `$taxonomy` to
`get_term_field()`, the parameter is no longer needed and has been deprecated.

Fixes #42605. See #42771.
Built from https://develop.svn.wordpress.org/trunk@42368


git-svn-id: http://core.svn.wordpress.org/trunk@42197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-04 21:49:46 +00:00
Boone Gorges
bc769416d8 get_the_category_by_ID() should be taxonomy-agnostic.
Prior to 4.9, this function was accidentally taxonomy-agnostic in most cases.
The fix in [40979] caused a regression in this function. For backward
compatibility, we make it explicit that the query is by ID only.

See #42771.
Built from https://develop.svn.wordpress.org/trunk@42367


git-svn-id: http://core.svn.wordpress.org/trunk@42196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-04 21:03:48 +00:00
Boone Gorges
1abbaa0f74 Fix regression in get_tag_link() since 4.9.
See [42364] for description of the problem.

Because `get_category_link()` is now totally taxonomy-agnostic, `get_tag_link()`
can become a simple wrapper.

Props juiiee8487, markjaquith.
See #42771.
Built from https://develop.svn.wordpress.org/trunk@42366


git-svn-id: http://core.svn.wordpress.org/trunk@42195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-04 20:52:48 +00:00
Boone Gorges
d8215873a2 Don't do a strict taxonomy check in get_category_link().
Prior to version 4.9, a quirk in the implementation of `get_term()` caused
`get_category_link( 123 )` to fetch the taxonomy archive link for term 123
even if 123 is not in the 'category' taxonomy. The quirk was fixed in [40979];
see #40671. This bugfix introduced a regression for theme authors who were
expecting the old behavior.

By lifting the 'category' restriction, we allow the template function to work
in the old way.

Fixes #42717. See #42771.
Built from https://develop.svn.wordpress.org/trunk@42364


git-svn-id: http://core.svn.wordpress.org/trunk@42193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-04 20:39:45 +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
Sergey Biryukov
a47a253e90 Taxonomy: After [40903], restore documentation for wp_dropdown_categories() arguments that are different from the defaults in WP_Term_Query::__construct().
Fixes #41058.
Built from https://develop.svn.wordpress.org/trunk@41767


git-svn-id: http://core.svn.wordpress.org/trunk@41601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-05 01:57:48 +00:00
John Blackbourn
4981452aba General: Fix more instances of inconsistent parameters passed to various filters, plus fix some filter docs.
See #38462, #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-03 16:13:44 +00:00
Drew Jaynes
dfab72aa35 Docs: Default for the orderby argument in wp_list_categories() is actually 'name', not 'ID'.
Props uicestone.
See #41017.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-12 22:06:39 +00:00
Boone Gorges
736e6a2977 Simplify documentation for wp_dropdown_categories().
Props ArnaudBan.
Fixes #41058.
Built from https://develop.svn.wordpress.org/trunk@40903


git-svn-id: http://core.svn.wordpress.org/trunk@40753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-15 09:39:42 +00:00
Andrea Fercia
bdad500af7 Widgets: Remove the title attributes used in the Tag cloud widget.
- improves accessibility using an aria-label attribute to match the information conveyed visually with the one exposed to assistive technologies
- adds an option in the widget to display the item counts, consistently with what other widgets already do (Archives, Categories)

Props adamsoucie, emirpprime, Samantha Miller., MikeLittle, rianrietveld, sami.keijonen, adamsilverstein, westonruter, afercia.
See #24766.
Fixes #35566.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-22 20:24:41 +00:00
Sergey Biryukov
47aab2faad Docs: Clarify that get_the_category_list() and the_category() display links as an unordered list by default.
See #39130.
Built from https://develop.svn.wordpress.org/trunk@40043


git-svn-id: http://core.svn.wordpress.org/trunk@39980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-05 15:16:44 +00:00
Sergey Biryukov
9d7ea04936 I18N: Merge similar strings in _deprecated_argument() calls.
Add translator comments.

Props ramiy, SergeyBiryukov.
Fixes #39020.
Built from https://develop.svn.wordpress.org/trunk@40028


git-svn-id: http://core.svn.wordpress.org/trunk@39965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-29 11:50:41 +00:00
John Blackbourn
80a839de13 Docs: Misc corrections and additions to inline documentation.
See #39130
Props keesiemeijer

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


git-svn-id: http://core.svn.wordpress.org/trunk@39579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 09:28:40 +00:00
John Blackbourn
d327c92e4b Docs: Add and correct @since docs for a variety of functions and methods.
Props keesiemeijer, chris_dev
Fixes #39343, #39357, #39344
See #39130

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


git-svn-id: http://core.svn.wordpress.org/trunk@39578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 09:21:44 +00:00
Boone Gorges
aa644128d6 Taxonomy: Use get_term_link() instead of get_category_link() in get_term_parents_list().
`get_category_link()` is a wrapper for `get_term_link()`. Using the
unwrapped function makes more sense semantically (it's taxonomy-
agnostic) and it's also more parsimonious (the `WP_Error` check in
`get_category_link()` is redundant with similar checks just before
in `get_term_link()`).

Props keesiemeijer.
Fixes #17069.
Built from https://develop.svn.wordpress.org/trunk@39593


git-svn-id: http://core.svn.wordpress.org/trunk@39533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-13 02:57:41 +00:00
Boone Gorges
74b6e1ba86 Taxonomy: Introduce get_term_parents_list().
This new function is a taxonomy-agnostic version of `get_category_parents()`.

Props keesiemeijer, SergeyBiryukov, rafaehlers.
Fixes #17069.
Built from https://develop.svn.wordpress.org/trunk@39549


git-svn-id: http://core.svn.wordpress.org/trunk@39489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-09 16:10:42 +00:00
John Blackbourn
042d09001a Taxonomy: Correct the type for the first parameter of the the_category filter.
See #39130

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


git-svn-id: http://core.svn.wordpress.org/trunk@39470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-07 01:23:42 +00:00
Sergey Biryukov
480501c6a8 Taxonomy: Prevent wp_list_categories() from producing not well-nested output if hide_title_if_empty is true.
Props chesio.
Fixes #38839. See #33460.
Built from https://develop.svn.wordpress.org/trunk@39280


git-svn-id: http://core.svn.wordpress.org/trunk@39220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-17 18:02:30 +00:00
Dominik Schilling
7cce73a634 General: Introduce a wp_list_sort() helper function, v2.
In addition to `wp_list_filter()` for filtering a list of objects, and `wp_list_pluck()` for plucking a certain field out of each object in a list, this new function can be used for sorting a list of objects by specific fields. These functions are now all contained within the new `WP_List_Util()` class and `wp_list_sort()` is used in various parts of core for sorting lists.

This was previously committed in [38859] but got reverted in [38862] and [38863]. To fix the previous issues, `wp_list_sort()` supports now an additional argument to preserve array keys via `uasort()`.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.
Built from https://develop.svn.wordpress.org/trunk@38928


git-svn-id: http://core.svn.wordpress.org/trunk@38871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 21:26:32 +00:00
Dominik Schilling
6c8508023f Revert [38859] due to an incomplete implementation.
See https://core.trac.wordpress.org/ticket/37128#comment:27.
See #37128.
Built from https://develop.svn.wordpress.org/trunk@38863


git-svn-id: http://core.svn.wordpress.org/trunk@38806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 17:01:32 +00:00
Pascal Birchler
f54558e75b General: Introduce a wp_list_sort() helper function.
In addition to `wp_list_filter()` for filtering a list of objects, and `wp_list_pluck()` for plucking a certain field out of each object in a list, this new function can be used for sorting a list of objects by specific fields. These functions are now all contained within the new `WP_List_Util()` class and `wp_list_sort()` is used in various parts of core for sorting lists.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.
Built from https://develop.svn.wordpress.org/trunk@38859


git-svn-id: http://core.svn.wordpress.org/trunk@38802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 11:12:51 +00:00
Sergey Biryukov
ec5782bed5 Docs: Fix typo in in_category() description.
Props Kenshino, mbootsman.
Fixes #38363.
Built from https://develop.svn.wordpress.org/trunk@38828


git-svn-id: http://core.svn.wordpress.org/trunk@38771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 13:46:44 +00:00
Andrea Fercia
7be7d396f1 Editor: Add a role button to the Tags meta box tag cloud links.
For better accessibility, the tag cloud links in the Tags meta box should be
reported to assistive technologies as buttons. They don't navigate to a new
resource, instead they perform an action.

Fixes #38318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-16 20:09:28 +00:00
Dion Hulse
f40c2a62a6 Taxonomy: Avoid a fatal error in the_tags() in the event that get_the_term_list() returns a WP_Error.
Props michalzuber.
See #37291.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-11 03:27:31 +00:00
Drew Jaynes
22adda2aa0 Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.
Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names.

Props ramiy.
See #37748.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 18:25:31 +00:00
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Sergey Biryukov
139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Drew Jaynes
5e5f5dd4e9 Docs: Improve return descriptions for get_the_category() and get_the_term() to specifically notate that an array of WP_Term objects is returned on success.
See #32246. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@37583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-01 22:46:28 +00:00
Drew Jaynes
3beb18d4f4 Docs: Improve documentation for wp_generate_tag_cloud() default arguments by formatting them into in a hash-notation.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-27 18:00:28 +00:00
Boone Gorges
253686fae6 Store only term IDs in object term relationships caches.
Previously, objects containing all data about a term were stored in each
object's term cache. Besides being wasteful, this approach caused invalidation
issues, as when a modified term count required a flush for all objects
belonging to the term.

Backward compatibility is maintained for plugins that continue to put object
data directly into the `{$taxonomy}_relationships` cache bucket.

Fixes #36814.
Built from https://develop.svn.wordpress.org/trunk@37573


git-svn-id: http://core.svn.wordpress.org/trunk@37541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-26 04:50:27 +00:00
Drew Jaynes
b9ed1cb665 Docs: Reorder argument descriptions in the DocBlock for wp_list_categories() to match the default arguments list and improve reading at a glance.
Props birgire for the initial patch.
Fixes #36693.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 19:40:27 +00:00
Drew Jaynes
6c34bf08a1 Docs: Add missing documentation for the style argument in the DocBlock for wp_list_categories().
Props birgire for the initial patch.
See #36693.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 19:35:37 +00:00
Drew Jaynes
da78aeffe9 Docs: Apply inline @see tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:59:27 +00:00
Drew Jaynes
c8c44a3111 Docs: Standardize filter docs in wp-includes/category-template.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:25:52 +00:00
Drew Jaynes
f52a8cb1fa Docs: Remove/replace invalid inline @link tags in DocBlocks in wp-includes/*.
Fixes #36910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:39:28 +00:00
Drew Jaynes
549e33a599 Docs: Remove several invalid inline @link tags from the DocBlock for wp_list_categories().
See #36910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:24:28 +00:00
Boone Gorges
03fa635ba7 Introduce required argument for wp_dropdown_categories().
This allows the HTML5 `required` attribute to be added to the `select` element.

Props wzislam, pcarvalho.
Fixes #31909.
Built from https://develop.svn.wordpress.org/trunk@37465


git-svn-id: http://core.svn.wordpress.org/trunk@37433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-19 02:39:27 +00:00
Boone Gorges
805a1ebadb Beautify, simplify, lovelify, alignify the default argument array in wp_dropdown_categories().
See #31909.
Built from https://develop.svn.wordpress.org/trunk@37463


git-svn-id: http://core.svn.wordpress.org/trunk@37431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-19 02:17:27 +00:00
John Blackbourn
e56457f7fe Taxonomy: Correct the accetped types for the taxonomy element in the arguments passed to wp_dropdown_categories().
Props grapplerulrich
Fixes #35446

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


git-svn-id: http://core.svn.wordpress.org/trunk@36256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-13 20:16:29 +00:00
Pascal Birchler
25ca04b95f Docs: Improve readability of the default arguments of wp_list_categories().
Adds missing documentation for the `separator` argument introduced in [35140].

Props birgire for initial patch.
Fixes #34751.
Built from https://develop.svn.wordpress.org/trunk@36135


git-svn-id: http://core.svn.wordpress.org/trunk@36101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-31 11:30:27 +00:00
Drew Jaynes
05e0d7c3c3 Docs: Add missing parameter and return descriptions to the DocBlocks for _wp_object_name_sort_cb() and _wp_object_count_sort_cb(), both uasort() callbacks.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-18 23:38:26 +00:00
Boone Gorges
b2f4f73633 Ensure that wp_list_categories() supports comma-separated lists for 'exclude' and 'exclude_tree'.
[34696] introduced a regression whereby comma-separated values for 'exclude'
and 'exclude_tree' would be handled improperly when merging the two parameters,
resulting in category IDs being incorrectly dropped from the combined array.

Props gblsm, hnle.
Fixes #35156.
Built from https://develop.svn.wordpress.org/trunk@36005


git-svn-id: http://core.svn.wordpress.org/trunk@35970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-18 18:12:25 +00:00
Boone Gorges
20651de171 Introduce 'tag-link-position-x' class to tag cloud links.
The new class describes the cardinal position of a link in the cloud, allowing
more fine-grained CSS and JS targeting.

Props Mte90, chmac.
Fixes #5172.
Built from https://develop.svn.wordpress.org/trunk@35984


git-svn-id: http://core.svn.wordpress.org/trunk@35949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-17 16:27:28 +00:00
Boone Gorges
812060f940 Improve handling for WP_Error objects in get_the_terms().
`wp_get_object_terms()` can return a `WP_Error` object. As such, the
`get_the_terms()` cache wrapper should handle them properly. To wit:

* Don't try to map an error object to `get_term()`. Introduced in [35032].
* Don't cache an error object as taxonomy relationships. Introduced in at least [16487], maybe earlier.

Props stephenharris.
Fixes #34723.
Built from https://develop.svn.wordpress.org/trunk@35850


git-svn-id: http://core.svn.wordpress.org/trunk@35814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-10 03:35:27 +00:00
Sergey Biryukov
b8e250927f In wp_list_categories(), rewrite a long condition for clarity.
See #34363.
Built from https://develop.svn.wordpress.org/trunk@35293


git-svn-id: http://core.svn.wordpress.org/trunk@35259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 16:13:26 +00:00
Boone Gorges
b285b3002a Correct inline comment in wp_list_categories().
The fallback link for the 'All' option is 'page_for_posts', not
'page_on_front'. Introduced in [32292].

Props sudar, SergeyBiryukov.
Fixes #34363.
Built from https://develop.svn.wordpress.org/trunk@35291


git-svn-id: http://core.svn.wordpress.org/trunk@35257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 12:55:27 +00:00
Drew Jaynes
2e11f8cc16 Taxonomy: Improve deprecated argument strings for the 'link' type in get_categories() and wp_dropdown_categories().
Props swissspidy, gagan0123.
Fixes #34318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-18 15:35:24 +00:00
Scott Taylor
296671abcc Taxonomy: in wp_list_categories(), add an arg: separator, to allow the overriding of <br/>.
Props wojtek.szkutnik.
Fixes #9025.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-13 17:02:25 +00:00
Boone Gorges
499d1b74ba Don't cache WP_Term objects in wp_get_object_cache().
The data stored in the cache should be raw database query results, not
`WP_Term` objects (which may be modified by plugins, and may contain additional
properties that shouldn't be cached).

If term relationships caches were handled in `wp_get_object_terms()` - where
a database query takes place - it would be straightforward to cache raw data.
See #34239. Since, in fact, `get_the_terms()` caches the value it gets from
`wp_get_object_terms()`, we need a technique that allows us to get raw data
from a `WP_Term` object. Mirroring `WP_User`, we introduce a `data` property
on term objects, which `get_the_terms()` uses to fetch cacheable term info.

Fixes #34262.
Built from https://develop.svn.wordpress.org/trunk@35032


git-svn-id: http://core.svn.wordpress.org/trunk@34997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:13:48 +00:00