Sergey Biryukov
ef14aed9a2
Use an existing string.
...
see #19205 .
Built from https://develop.svn.wordpress.org/trunk@29234
git-svn-id: http://core.svn.wordpress.org/trunk@29018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-18 23:56:14 +00:00
Scott Taylor
cf3deb2ecb
Avoid a race condition when multiple windows are open so that orphaned terms cannot be created by accident.
...
Adds a unit test.
Props dlh.
Fixes #19205 .
Built from https://develop.svn.wordpress.org/trunk@29196
git-svn-id: http://core.svn.wordpress.org/trunk@28980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 21:52:15 +00:00
Drew Jaynes
164f31e8e8
Add indentation for the hash notation missed in [29128].
...
See #28841 .
Built from https://develop.svn.wordpress.org/trunk@29129
git-svn-id: http://core.svn.wordpress.org/trunk@28914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-13 04:18:15 +00:00
Drew Jaynes
862cc336d2
Convert default arguments documentation for get_terms()
into a hash notation.
...
See #28841 .
Built from https://develop.svn.wordpress.org/trunk@29128
git-svn-id: http://core.svn.wordpress.org/trunk@28913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-13 04:15:16 +00:00
Scott Taylor
fabec026c2
The 2nd argument to array_unique()
was added to PHP in 5.2.9, so don't use it. We have to use our own code to return unique terms when fields => all
in wp_get_object_terms()
.
...
See #28843 and [28583].
Built from https://develop.svn.wordpress.org/trunk@29119
git-svn-id: http://core.svn.wordpress.org/trunk@28905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-12 03:54:15 +00:00
Drew Jaynes
d4dd02b4ae
Remove backticks on $post
variables in some short parameter descriptions.
...
See [28653], [28654].
See #28388 .
Built from https://develop.svn.wordpress.org/trunk@28976
git-svn-id: http://core.svn.wordpress.org/trunk@28765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-03 19:28:14 +00:00
Sergey Biryukov
19a3159082
Make default 'template' argument of the_taxonomies() and get_the_taxonomies() translatable.
...
props juliobox.
fixes #28714 .
Built from https://develop.svn.wordpress.org/trunk@28957
git-svn-id: http://core.svn.wordpress.org/trunk@28753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-02 13:21:16 +00:00
Drew Jaynes
52fbb3c484
Fix parameter description for $append
in wp_set_object_terms()
inline docs.
...
See #26570 .
Built from https://develop.svn.wordpress.org/trunk@28952
git-svn-id: http://core.svn.wordpress.org/trunk@28749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-02 01:39:15 +00:00
Sergey Biryukov
1b23dd8f05
Clarify the docs and add more unit tests for wp_set_object_terms().
...
props DrewAPicture.
fixes #26570 .
Built from https://develop.svn.wordpress.org/trunk@28951
git-svn-id: http://core.svn.wordpress.org/trunk@28748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-02 01:28:15 +00:00
Sergey Biryukov
a8d0832a15
Notify developers when register_post_type() or register_taxonomy() fails because of post type or taxonomy key length.
...
props mattheweppelsheimer.
fixes #28683 .
Built from https://develop.svn.wordpress.org/trunk@28902
git-svn-id: http://core.svn.wordpress.org/trunk@28701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-29 21:54:14 +00:00
Sergey Biryukov
16595af731
Correct @return value for term_exists().
...
props simonwheatley.
fixes #28538 .
Built from https://develop.svn.wordpress.org/trunk@28753
git-svn-id: http://core.svn.wordpress.org/trunk@28567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-14 14:57:16 +00:00
Scott Taylor
17b17d1c78
Don't use variable variables in get_terms()
.
...
See #27881 .
Built from https://develop.svn.wordpress.org/trunk@28736
git-svn-id: http://core.svn.wordpress.org/trunk@28550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-11 17:41:14 +00:00
Scott Taylor
980744f882
In wp_insert_term()
, when no slug is provided, check for an existing term by name. If it exists, use that slug instead of calling sanitize_title( $name )
.
...
Prevents creating an endless number of terms like `A+` or `$$$$` in any given taxonomy.
Props wonderboymusic, SergeyBiryukov, aaroncampbell.
Fixes #17689 .
Built from https://develop.svn.wordpress.org/trunk@28733
git-svn-id: http://core.svn.wordpress.org/trunk@28547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-11 02:28:14 +00:00
Scott Taylor
05eeb16e30
Replace all uses of like_escape()
with $wpdb->esc_like()
.
...
Props miqrogroove.
See #10041 .
Built from https://develop.svn.wordpress.org/trunk@28712
git-svn-id: http://core.svn.wordpress.org/trunk@28528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 00:44:15 +00:00
Drew Jaynes
b0877f02a4
Make sure $post
is properly documented as optional where applicable.
...
See #28388 .
Built from https://develop.svn.wordpress.org/trunk@28653
git-svn-id: http://core.svn.wordpress.org/trunk@28471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-03 03:53:17 +00:00
Scott Taylor
96d788132a
When queries are passed to WP_Tax_Query
, the value for operator
is assumed to be uppercase. This is an unnecessary constraint. In ->get_sql()
, cast it using $operator = strtoupper( $query['operator'] )
.
...
Props clifgriffin.
Fixes #27557 .
Built from https://develop.svn.wordpress.org/trunk@28618
git-svn-id: http://core.svn.wordpress.org/trunk@28442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-29 17:53:15 +00:00
Scott Taylor
8653099a83
In wp_get_object_terms()
, before returning terms (and before running them through the 'wp_get_object_terms' filter) - run them through $terms = array_values( array_unique( $terms, SORT_REGULAR ) )
.
...
There will be "dupes" when the function is called with `'fields' => 'all_with_object_id'`, but the objects will actually be unique due to the `object_id` addition, so they shouldn't be filtered out.
Adds unit tests. All other unit tests pass.
Fixes #11003 .
Built from https://develop.svn.wordpress.org/trunk@28583
git-svn-id: http://core.svn.wordpress.org/trunk@28408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-27 03:29:14 +00:00
Scott Taylor
44c4b365a0
When adding queries to tax_query
: if the query's field
is term_taxonomy_id
, don't require taxonomy
to be specified. In WP_Tax_Query::transform_query()
, $query['taxonomy']
is never checked for the 'term_taxonomy_id' case
because 'term_taxonomy_id' is the primary key being looked up.
...
Adds unit tests.
Props helen.
Fixes #25284 .
Built from https://develop.svn.wordpress.org/trunk@28562
git-svn-id: http://core.svn.wordpress.org/trunk@28388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-23 19:59:14 +00:00
Scott Taylor
b8d469600b
These functions import $wpdb
but do not use it.
...
See #27882 .
Built from https://develop.svn.wordpress.org/trunk@28539
git-svn-id: http://core.svn.wordpress.org/trunk@28365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-22 17:37:14 +00:00
Scott Taylor
eea7052df8
Eliminate the use of extract()
in wp_delete_term()
.
...
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28466
git-svn-id: http://core.svn.wordpress.org/trunk@28293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-17 14:55:14 +00:00
Scott Taylor
bec9993f38
Eliminate the use of extract()
in get_terms()
.
...
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28465
git-svn-id: http://core.svn.wordpress.org/trunk@28292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-17 14:47:14 +00:00
Scott Taylor
c1b5670a00
Eliminate the use of extract()
in wp_insert_term()
.
...
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28464
git-svn-id: http://core.svn.wordpress.org/trunk@28291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-17 14:16:14 +00:00
Scott Taylor
66c3f62a54
Eliminate use of extract()
in wp_update_term()
.
...
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28461
git-svn-id: http://core.svn.wordpress.org/trunk@28288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-16 21:29:13 +00:00
Scott Taylor
5a5c86139f
Eliminate use of extract()
in wp_get_object_terms()
.
...
There are 3 properties, just set them to variables. They are used too often to warrant a refactor.
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28441
git-svn-id: http://core.svn.wordpress.org/trunk@28268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 19:58:15 +00:00
Scott Taylor
eb2bbf9c97
Eliminate the use of extract()
in get_objects_in_term()
. Only one property (order
) was extracted.
...
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28423
git-svn-id: http://core.svn.wordpress.org/trunk@28250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 05:43:16 +00:00
Scott Taylor
80a37d2fcd
Eliminate the use of extract()
in WP_Tax_Query::get_sql()
. All unit tests still pass.
...
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28422
git-svn-id: http://core.svn.wordpress.org/trunk@28249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 05:41:14 +00:00
Scott Taylor
e6fad96f5e
Eliminate the use of extract()
in the_taxonomies()
. Adds unit test.
...
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28421
git-svn-id: http://core.svn.wordpress.org/trunk@28248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 05:25:14 +00:00
Scott Taylor
c0b0b00e6d
Eliminate use of extract()
in get_the_taxonomies()
. Adds unit test.
...
See #22400 .
Built from https://develop.svn.wordpress.org/trunk@28415
git-svn-id: http://core.svn.wordpress.org/trunk@28242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 03:51:13 +00:00
Sergey Biryukov
3ad1c8897c
Correct 'show_in_menu' parameter description in register_taxonomy().
...
fixes #27943 .
Built from https://develop.svn.wordpress.org/trunk@28241
git-svn-id: http://core.svn.wordpress.org/trunk@28069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-02 11:29:13 +00:00
Andrew Nacin
6ca804ee76
Avoid infinite recursion in get_term_children() when a term is incorrectly a parent of itself.
...
props kovshenin.
fixes #27123 .
Built from https://develop.svn.wordpress.org/trunk@27837
git-svn-id: http://core.svn.wordpress.org/trunk@27671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-29 06:08:15 +00:00
Drew Jaynes
4bd2c5ce85
Inline documentation for hooks in wp-includes/taxonomy.php.
...
Props kpdesign for some minor language tweaks.
Fixes #27505 .
Built from https://develop.svn.wordpress.org/trunk@27827
git-svn-id: http://core.svn.wordpress.org/trunk@27661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-28 21:29:13 +00:00
Drew Jaynes
da19fc531c
Better standardize parameter value types in PHPDocs where both a post ID or WP_Post
would be acceptable.
...
Covers cases where previously only `int` or `int|object` types were notated.
Props coffee2code for the original patch.
See #20495 .
Built from https://develop.svn.wordpress.org/trunk@27473
git-svn-id: http://core.svn.wordpress.org/trunk@27318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 19:32:16 +00:00
Scott Taylor
c353fa41a2
In get_terms()
, leverage get_term_children()
over _get_term_children()
when making sure to show empty terms that have children in a hierarchical taxonomy while avoiding duplicates.
...
Adds unit test for `child_of` param. Adjusts unit tests for `get_terms()`.
See [27108] and [27125].
Props SergeyBiryukov.
Fixes #27123 .
Built from https://develop.svn.wordpress.org/trunk@27458
git-svn-id: http://core.svn.wordpress.org/trunk@27304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-07 19:29:16 +00:00
Scott Taylor
3556e565b3
get_term_children()
returns an array of IDs, not objects. The docs have been updated to reflect this.
...
Fixes #27312 .
Built from https://develop.svn.wordpress.org/trunk@27457
git-svn-id: http://core.svn.wordpress.org/trunk@27303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-07 19:16:15 +00:00
Andrew Nacin
d24a109288
Revert [27115] and let cache backends handle the stripping of spaces in cache keys as necessary.
...
microtime() returns greater precision than microtime(true).
see #27000 , #23448 , #26903 , #14485 .
Built from https://develop.svn.wordpress.org/trunk@27300
git-svn-id: http://core.svn.wordpress.org/trunk@27153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-26 22:05:13 +00:00
Drew Jaynes
cb8951b0b3
Remove all @package
and @subpackage
PHPDoc tags not at the file- or class-levels in core.
...
See #27200 .
Built from https://develop.svn.wordpress.org/trunk@27262
git-svn-id: http://core.svn.wordpress.org/trunk@27119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:14:14 +00:00
Scott Taylor
c1dbe9ab77
Remove extraneous type-casting in wp_get_object_terms()
.
...
Props OriginalEXE.
Fixes #27133 .
Built from https://develop.svn.wordpress.org/trunk@27186
git-svn-id: http://core.svn.wordpress.org/trunk@27046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-17 21:56:12 +00:00
Scott Taylor
5a43c3324d
Partially revert [27101], [27102], [27141], and [27142]. Those commits introduced new functions to sync up cache invalidation events. The current commit alters existing internals.
...
"The cache invalidation with static was introduced in r9102 with version 2.7. Multisite wasn't in core back then, so something like switch_to_blog() wasn't a concern, but now it breaks if you switch the blog in between calls to clean_term_cache."
This solution is simpler. All unit tests pass. Removes unnecessary tests linked to removed functions.
Props kovshenin.
Fixes #14485 , #22526 .
Built from https://develop.svn.wordpress.org/trunk@27163
git-svn-id: http://core.svn.wordpress.org/trunk@27029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-11 16:50:13 +00:00
Scott Taylor
6a626ab231
Reuse the terms
cache group for taxonomy cache invalidation.
...
See #22526 , #14485 , [27101], [27102].
Built from https://develop.svn.wordpress.org/trunk@27142
git-svn-id: http://core.svn.wordpress.org/trunk@27009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-09 17:42:11 +00:00
Drew Jaynes
f481bcd2db
Improve inline documentation for several 'last_changed'-related functions introduced in [27101] and [27102].
...
Functions include:
* `get_taxonomy_last_changed()`
* `set_taxonomy_last_changed()`
* `post_taxonomy_is_fresh()`
* `taxonomy_hierarchy_is_fresh()`
Fixes #22526 , #14485 .
Built from https://develop.svn.wordpress.org/trunk@27141
git-svn-id: http://core.svn.wordpress.org/trunk@27008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-09 02:02:12 +00:00
Scott Taylor
75d8688f60
When a term_id
matches in _get_term_children()
, recurse through its children until there is no more depth in the hierarchy. Since get_terms()
return terms with a count
of 0
when their children are not empty, we must return all children so that get_terms()
can check their count.
...
In [27108], #26903 was fixed, but only because we were using the example in the ticket, leaving out infinite depth for hierarchical taxonomies.
Adds unit tests, including `Tests_Term_getTerms::test_get_terms_seven_levels_deep()`.
Fixes #26903 . Again.
Built from https://develop.svn.wordpress.org/trunk@27125
git-svn-id: http://core.svn.wordpress.org/trunk@26992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-07 19:53:12 +00:00
Andrew Nacin
084a7b50cd
Use a float for last_changed microtime cache values.
...
microtime() by default returns a string with a space, which isn't allowed for keys in some cache backends.
props _jameslee, drozdz.
fixes #27000 . see #23448 .
Built from https://develop.svn.wordpress.org/trunk@27115
git-svn-id: http://core.svn.wordpress.org/trunk@26982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-07 08:14:12 +00:00
Scott Taylor
c2b712e3b9
In get_terms()
, don't set automatically hierarchical
to false
when parent => 0
is passed. The default value for parent
is ''
.
...
In `_get_term_children()`, don't skip a top-level term without first including its children in the returned term list. Ironically, the call to `_get_term_children()` in `get_terms()` has a comment stating `"Make sure we show empty categories that have children."`, but it didn't work if you were retrieving top-level categories only.
All unit tests pass. Added a unit test based on the use case described in this ticket.
Fixes #26903 .
Built from https://develop.svn.wordpress.org/trunk@27108
git-svn-id: http://core.svn.wordpress.org/trunk@26975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-06 17:45:12 +00:00
Scott Taylor
5d03d8eb50
Regenerate the term hierarchy cache ({taxonomy}_children
) when it is out of sync with the passed taxonomy's last_changed
value.
...
Introduces `taxonomy_hierarchy_is_fresh()`, which is only called in `_get_term_hierarchy()`. The taxonomy's `last_changed` value is checked against the value of `wp_cache_get( 'hierarchy_last_changed', $taxonomy )`.
Adds a unit test - `Tests_Term:test_hierachy_invalidation()`.
See [27101], which makes this type of cache invalidation possible.
Fixes #14485 .
Built from https://develop.svn.wordpress.org/trunk@27102
git-svn-id: http://core.svn.wordpress.org/trunk@26971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-06 01:58:14 +00:00
Scott Taylor
578dbcd9f5
Add cache invalidation when updating a term, example: create a category, assign it to a post, edit the category. Currently, the post's term cache is not updated. When updating terms in a given taxonomy, invalidate the object term caches linked to that taxonomy.
...
Introduce `get_taxonomy_last_changed()`, `set_taxonomy_last_changed()`, and `post_taxonomy_is_fresh()`.
`post_taxonomy_is_fresh()` is only called in `get_object_term_cache()` - at which point the taxonomy's `last_changed` value is checked against the post's `{$taxonomy}_last_changed` value.
`set_taxonomy_last_changed()` is called whenever directory database queries are made that insert new terms or affect existing terms.
Fixes #22526 .
Built from https://develop.svn.wordpress.org/trunk@27101
git-svn-id: http://core.svn.wordpress.org/trunk@26970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-06 01:41:12 +00:00
Scott Taylor
a6b3bced06
get_comment()
, wp_get_post_revision()
, and get_term()
all used to return by reference. Because of this, $null
was set to null
so the return value would be a variable where applicable. This has not been necessary since [21792], so the $null
s have been removed.
...
Props toszcze.
Fixes #24768 .
Built from https://develop.svn.wordpress.org/trunk@27057
git-svn-id: http://core.svn.wordpress.org/trunk@26930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-29 06:46:12 +00:00
Drew Jaynes
d13198db3a
Add inline documentation for the 'show_admin_column' argument added to register_taxonomy()
in 3.5.
...
Also adds a 'show_admin_column' value to the defaults array.
Props johnbillion.
Fixes #26707 .
Built from https://develop.svn.wordpress.org/trunk@26912
git-svn-id: http://core.svn.wordpress.org/trunk@26793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-07 02:13:10 +00:00
Drew Jaynes
cd8cedc40d
First there were two, and now there are three -- in the @since versions that came before and that shall be. And so it will be, says nacin.
...
Props JustinSainton, SergeyBiryukov, DrewAPicture.
Fixes #26713 .
Built from https://develop.svn.wordpress.org/trunk@26868
git-svn-id: http://core.svn.wordpress.org/trunk@26754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-24 18:57:12 +00:00
Andrew Nacin
804be8b332
Be specific in term_exists error messages in wp_insert_term() as to what already exists (name, or name and slug).
...
props ericmann, SergeyBiryukov.
fixes #15741 .
Built from https://develop.svn.wordpress.org/trunk@26544
git-svn-id: http://core.svn.wordpress.org/trunk@26436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-02 23:06:11 +00:00
Scott Taylor
ff6233b9c5
Fix lingering reference problem in wp_get_object_terms()
by not setting the foreach
'd vars to a reference. Adds unit test.
...
Props stephenharris.
Fixes #26339 .
Built from https://develop.svn.wordpress.org/trunk@26510
git-svn-id: http://core.svn.wordpress.org/trunk@26404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-02 00:00:10 +00:00