Commit Graph

539 Commits

Author SHA1 Message Date
Boone Gorges
c357de63ef Don't force child_of=0 for non-hierarchical taxonomies in get_terms().
This forcing appears to have been introduced to save unnecessary queries, but
(a) in some cases it appeared to be causing *more* queries, and (b) it caused
incorrect results when the 'exclude_tree' param of `get_terms()` called
`get_terms()` on each item in the tree using the 'child_of' param.

Fixes #30275.
Built from https://develop.svn.wordpress.org/trunk@30265


git-svn-id: http://core.svn.wordpress.org/trunk@30265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-06 21:47:23 +00:00
Boone Gorges
3706590afb Split shared taxonomy terms during term update.
When updating an existing taxonomy term that shares its `term_id` with
another term, we generate a new row in `wp_terms` and associate the updated
term_taxonomy_id with the new term. This separates the terms, such that
updating the name of one term does not change the name of any others.

Note that this term splitting only occurs on installations whose database
schemas have been upgraded to version 30133 or higher. Note also that shared
terms are only split when run through `wp_update_term()`, as on edit-tags.php;
we will wait until a future release of WordPress to force the splitting of all
shared taxonomy terms.

Props boonebgorges, rmccue, greuben, garyc40, wonderboymusic, imath, jesin.
Fixes #5809.
Built from https://develop.svn.wordpress.org/trunk@30241


git-svn-id: http://core.svn.wordpress.org/trunk@30241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-05 02:03:23 +00:00
Boone Gorges
32db3d1fe5 Do not create shared taxonomy terms.
A "shared" term occurs when two entries in the `wp_term_taxonomy` table share a
single `term_id`, and thereby correspond to the same row in `wp_terms`. This
changeset stops the practice of creating shared terms: each new row in
`wp_term_taxonomy` will receive its own row in `wp_terms`. The new strategy
for term creation depends on whether the installation's database schema is up
to date for 4.1:

* If so, terms are allowed to be created with the same slug as an existing term, as long as they are in different taxonomies and do not share a parent. Thus, a new tag with the slug 'wordpress' can exist alongside a category with the slug 'wordpress'.
* If not, new terms will be forced to have unique slugs. Thus, on an installation containing a category with the slug 'wordpress', a new tag 'WordPress' will get the slug 'wordpress-2'.

Fixes #21950. See #5809.
Built from https://develop.svn.wordpress.org/trunk@30240


git-svn-id: http://core.svn.wordpress.org/trunk@30240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-05 01:42:22 +00:00
Boone Gorges
ef13be6f27 Enforce ORDER BY and LIMIT clauses in term_exists() queries.
In case of edge cases where a duplicate term might exist in a replicated
database for a split second, these explicit query clauses ensure that
`term_exists()` will always recognize the oldest matched term as the
canonical one. See [30238] for background.

Props pento.
See #22023, #5809.
Built from https://develop.svn.wordpress.org/trunk@30239


git-svn-id: http://core.svn.wordpress.org/trunk@30239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-05 01:09:21 +00:00
Boone Gorges
4ce9db9ce8 In wp_insert_term(), clean up accidental duplicate terms after insert.
In [30056], the UNIQUE index was removed from the 'slug' column of `wp_terms`.
While we have numerous checks in place to avoid the creation of unwanted
duplicate term+term_taxonomy pairs, it's possible that in certain edge cases -
such as during the lag caused by database replication, or a race condition
involving near-simultaneous creation of more than one term - we'll end up
unwittingly inserting two identical rows.

The current changeset minimizes this risk by introducing a failsafe mechanism
into `wp_insert_term()`. After a term and term_taxonomy are INSERTed, we check
to see whether the term just created is a duplicate of an existing term; if so,
we delete the new one and keep the old one. This prevents problems caused by
replication lag, because SELECT queries that take place after an INSERT will
hit the master database; it mitigates race conditions by enforcing that the
term that was created first (ie, the one with the lowest `term_id`) is
always the "canonical" one.

Props nacin, markjaquith.
See #22023, #5809.
Built from https://develop.svn.wordpress.org/trunk@30238


git-svn-id: http://core.svn.wordpress.org/trunk@30238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-05 01:00:24 +00:00
Boone Gorges
7919a6d812 Improve docblocks for get_the_taxonomies() and the_taxonomies().
* In `the_taxonomies()`, only document those arguments that are specific to the function. Arguments shared with `get_the_taxonomies()` should be documented in the later function's docblock.
* Add $args hash documentation to `get_the_taxonomies()`.
* Remove the redundant default argument definition in `the_taxonomies()`.

Fixes #27238.
Built from https://develop.svn.wordpress.org/trunk@30210


git-svn-id: http://core.svn.wordpress.org/trunk@30210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 18:49:45 +00:00
Boone Gorges
eec3eea392 Introduce term_template param to get_the_taxonomies().
This parameter allows theme and plugin authors to specify the formatting they
would like on the term links as they are parsed into the taxonomy list.

Props hereswhatidid, dlh, davidjlaietta.
See #27238.
Built from https://develop.svn.wordpress.org/trunk@30209


git-svn-id: http://core.svn.wordpress.org/trunk@30209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 18:49:24 +00:00
Boone Gorges
fc4b17a5d2 In in_object_in_term(), only check numeric string values against term_id.
The previous `in_array()` check was playing too loose with mixed types, such
that a string like '10_term_name' would incorrectly match a term_id 10.

Props nobinobi, realloc.
Fixes #29467.
Built from https://develop.svn.wordpress.org/trunk@30205


git-svn-id: http://core.svn.wordpress.org/trunk@30205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 14:25:44 +00:00
Scott Taylor
a587ebc946 In WP_Tax_Query, declare $primary_table and $primary_id_column as properties.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 03:45:22 +00:00
Boone Gorges
96b42c2fdc Allow resource_type to be specified in get_ancestors().
Being explicit about resource type (taxonomy vs post_type) allows for the
proper resolution of conflicts when a taxonomy and post_type share a slug.

Props filosofo.
Fixes #15029.
Built from https://develop.svn.wordpress.org/trunk@30141


git-svn-id: http://core.svn.wordpress.org/trunk@30141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-01 02:58:23 +00:00
Drew Jaynes
66c47f29bb Correct references of @uses $wpdb in core documentation to use @global.
See #30191, [30105].
Fixes #30217.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 17:56:22 +00:00
Boone Gorges
af026330c4 Clean up get_term_by() caching.
* Fix cache key/group modification that was missed in [30073].
* Update unit tests to reflect new key/group format.

Props tollmanz.
Fixes #21760.
Built from https://develop.svn.wordpress.org/trunk@30108


git-svn-id: http://core.svn.wordpress.org/trunk@30108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 02:50:23 +00:00
Boone Gorges
47742eae12 In get_terms(), do not override 'hierarchical' and 'pad_counts' when 'parent' is present.
The previous behavior resulted in descendant terms being improperly excluded
from the results when passing a 'parent', even when 'hierarchical' had been
set to true.

The patch also adds unit tests that demonstrate the various interactions
between the 'child_of', 'parent', and 'hierarchical' parameters of `get_terms()`.

Props landakram.
Fixes #29815.
Built from https://develop.svn.wordpress.org/trunk@30107


git-svn-id: http://core.svn.wordpress.org/trunk@30107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 02:12:22 +00:00
Drew Jaynes
f8657d5890 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Boone Gorges
e9adba887d Introduce 'pre_delete_term' hook.
Props cmmarslender.
Fixes #30127.
Built from https://develop.svn.wordpress.org/trunk@30088


git-svn-id: http://core.svn.wordpress.org/trunk@30088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 02:44:22 +00:00
Boone Gorges
4013156e51 Be more specific in documentation of 'slug' param for get_terms().
Props jfarthing84.
Fixes #23636.
Built from https://develop.svn.wordpress.org/trunk@30086


git-svn-id: http://core.svn.wordpress.org/trunk@30086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 02:35:23 +00:00
Boone Gorges
682fb09f01 Update inline docs for [30052].
Fixes #23261.
Built from https://develop.svn.wordpress.org/trunk@30077


git-svn-id: http://core.svn.wordpress.org/trunk@30077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 21:26:22 +00:00
Scott Taylor
315612a96b Adjust caching for get_term_by() calls:
* Remove md5 hashes for term name cache keys
* Remove the namespace for the keys for `names` and `slugs` and add them to the group names
* Remove `wp_get_last_changed()`, which @nacin hated
 
Props tollmanz.
Fixes #21760.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 21:05:23 +00:00
Boone Gorges
bd48b40cc4 Introduce orderby=include support for get_terms().
Props wpsmith.
Fixes #23261.
Built from https://develop.svn.wordpress.org/trunk@30052


git-svn-id: http://core.svn.wordpress.org/trunk@30052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 18:13:19 +00:00
Boone Gorges
4177b48b1e Allow 'slug' param of get_terms() to accept an array.
Props jfarthing84, dlh.
Fixes #23636.
Built from https://develop.svn.wordpress.org/trunk@30042


git-svn-id: http://core.svn.wordpress.org/trunk@30042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-28 14:57:22 +00:00
Boone Gorges
61115c51f7 Improve WP_Tax_Query param sanitization for empty strings.
When an empty string is passed as one of the clauses in the `$tax_query`
parameter, it should be discarded rather than parsed as a first-order clause.

Props tmtrademark.
Fixes #30117.
Built from https://develop.svn.wordpress.org/trunk@30031


git-svn-id: http://core.svn.wordpress.org/trunk@30031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-26 22:57:18 +00:00
Boone Gorges
43fb0af4f1 Invalidate cache for child terms when parent term is deleted.
Props socki03.
Fixes #29911.
Built from https://develop.svn.wordpress.org/trunk@29945


git-svn-id: http://core.svn.wordpress.org/trunk@29695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-17 20:59:20 +00:00
Boone Gorges
3949a8b6cc Remove invalid continue calls from WP_Tax_Query::get_sql_for_clause().
This was leftover code from the previous implementation, which used a `foreach()`
loop. See [29901].

Props nofearinc.
See #29738, #29718.
Built from https://develop.svn.wordpress.org/trunk@29931


git-svn-id: http://core.svn.wordpress.org/trunk@29683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-16 22:07:20 +00:00
Scott Taylor
84a26a78a8 Cache get_term_by() calls:
* Add a helper function, `wp_get_last_changed()`, to retrieve a last-modified timestamp by cache group
* When caching a term, also make cache entries for slug and name via `slug:{$term_id}` and `name:{$term_id}` keys in the `$taxonomy:$last_changed` bucket that reference the term_id
* In `clean_term_cache()` and `update_term_cache()`, respect `$_wp_suspend_cache_invalidation`
* Original term cache entries maintain BC

Adds unit tests.

Props wonderboymusic, tollmanz, boonebgorges.
Fixes #21760.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-16 04:45:17 +00:00
Boone Gorges
af6beda45b Avoid redundant table joins in WP_Tax_Query.
IN clauses that are connected by OR require only a single table join. To avoid
extraneous joins, keep track of generated table aliases, and let sibling
clauses piggy-back on those aliases when possible.

Introduces WP_Tax_Query::sanitize_relation() to reduce some repeated code.

Adds unit tests to verify the JOIN consolidation, and integration tests for
cases where JOINS are being combined.

Props boonebgorges, otto42, jakub.tyrcha.
Fixes #18105.
Built from https://develop.svn.wordpress.org/trunk@29902


git-svn-id: http://core.svn.wordpress.org/trunk@29657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-15 16:40:18 +00:00
Boone Gorges
09fbcfc1ad Support 'EXISTS' and 'NOT EXISTS' in WP_Tax_Query.
These new values for the 'operator' parameter make it possible to filter items
that have no term from a given taxonomy, or any term from a given taxonomy.

Includes unit tests.

Fixes #29181.
Built from https://develop.svn.wordpress.org/trunk@29896


git-svn-id: http://core.svn.wordpress.org/trunk@29651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-15 00:54:21 +00:00
Boone Gorges
0143196338 Introduce support for nested queries in WP_Tax_Query.
Previously, tax query arguments could be joined by a single AND or OR relation.
Now, these queries can be arbitrarily nested, allowing clauses to be linked
together with multiple relations.

In a few places, WP_Query runs through a list of clauses in a tax_query in order
to set certain query vars for backward compatibility. The necessary changes have
been made to WP_Query to support this feature with the new complex structure of
tax_query. Unit tests are included for these backward compatibility fixes.

Unit tests for the new nesting syntax are included.

Props boonebgorges.
Fixes #29718. See #29738.
Built from https://develop.svn.wordpress.org/trunk@29891


git-svn-id: http://core.svn.wordpress.org/trunk@29647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-14 04:03:19 +00:00
Boone Gorges
d088de7195 Return an error when adding a term to a non-existent parent.
Parallels the logic of wp_insert_term(), introduced in [29196].

Props jesin.
Fixes #29614.
Built from https://develop.svn.wordpress.org/trunk@29867


git-svn-id: http://core.svn.wordpress.org/trunk@29627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-09 18:12:20 +00:00
Drew Jaynes
a724b435d8 Add more complete inline documentation for get_term_link().
Adds more complete parameter descriptions for the `$term` and `$taxonomy` parameters. 

Props amruta123.b for the initial patch.
Fixes #29901.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-09 15:41:18 +00:00
Boone Gorges
587599c54f Don't bail out of term_exists() when term sanitizes to an empty string.
This change brings return values for failures of this sort in line with other
failed lookups in term_exists(): a null value is now returned in all cases
where the queried term is not found.

Adds unit test for the sanitization issue. Modifies existing unit test to
reflect the change in return value for empty term strings.

Props boonebgorges, georgestephanis.
Fixes #29589.
Built from https://develop.svn.wordpress.org/trunk@29865


git-svn-id: http://core.svn.wordpress.org/trunk@29625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-09 03:16:18 +00:00
Boone Gorges
61317341eb Fix term_exists() for parent = 0.
Passing a 0 (or '0') as the 'parent' param of term_exists() should limit
results to terms with no parent.

Adds unit test.

Fixes #29851.
Built from https://develop.svn.wordpress.org/trunk@29863


git-svn-id: http://core.svn.wordpress.org/trunk@29623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-09 02:49:18 +00:00
Boone Gorges
3ceee6cd24 Improve 'alias_of' handling in wp_insert_term() and wp_update_term().
Using get_term_by() rather than direct SQL queries to fetch the alias term
fixes a number of issues:

* Object cache for aliased term is properly cleared after update.
* If the aliased term is in the object cache, it's served from there, saving a database query.
* Duplicate 'edit_terms' and 'edited_terms' hooks can be removed.
* Fix a PHP notice when the 'alias_of' term is not found.
* Prevent the incorrect creation of a new term group for the primary term when the 'alias_of' term is not found.

Adds unit tests for 'alias_of' functionality in both functions.

Fixes #29848.
Built from https://develop.svn.wordpress.org/trunk@29862


git-svn-id: http://core.svn.wordpress.org/trunk@29622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-09 02:32:19 +00:00
Boone Gorges
17631e3b8e Explicitly declare hierarchical=false for post_tag in create_initial_taxonomies().
In certain edge cases, such as during the automated test suite,
create_initial_taxonomies() can be called in a situation where a non-default
permastruct setting has been saved outside of wp-admin. This causes the
'hierarchical' setting for the post_tag taxonomy to remain unset, leading to
PHP notices in get_term_link().

See #29827.
Built from https://develop.svn.wordpress.org/trunk@29859


git-svn-id: http://core.svn.wordpress.org/trunk@29620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-09 00:58:20 +00:00
Boone Gorges
0c64fe335a In get_terms(), select term taxonomy count for all values of 'fields'.
Not having the count caused queries with 'fields' values of 'id=>name' and
'id=>slug' to return incorrect results when querying a hierarchical taxonomy
with 'hide_empty=true'.

Includes unit tests for get_terms() when using various combinations of 'fields',
'hide_empty', and 'hierarchical' arguments.

Props technical_mastermind.
Fixes #29859.
Built from https://develop.svn.wordpress.org/trunk@29845


git-svn-id: http://core.svn.wordpress.org/trunk@29608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-06 22:05:18 +00:00
Scott Taylor
d4d1fcda0f wp_update_term() should mimic wp_insert_term() and set a value for $term_group before the alias_of logic runs. This ensures that $term_group exists when compact() is called.
See [28461].
Fixes #29278.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-20 17:04:18 +00:00
John Blackbourn
93c80ac896 Docblock corrections for get_the_terms() function and corresponding filter, and registered_taxonomy action. Fixes #29183.
Built from https://develop.svn.wordpress.org/trunk@29467


git-svn-id: http://core.svn.wordpress.org/trunk@29245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-11 21:17:17 +00:00
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