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
Sergey Biryukov
bf6f02320a
A negative term parent value should be sanitized to 0, not 1. Fix a regression in sanitize_term_field() caused by [26010].
...
props mattheu for initial patch.
fixes #25852 .
Built from https://develop.svn.wordpress.org/trunk@26028
git-svn-id: http://core.svn.wordpress.org/trunk@25958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-06 23:41:09 +00:00
Scott Taylor
cefafee3d3
Cast proper fields to int
when returning from wp_get_object_terms()
. Add term_taxonomy_id
and object_id
to the list in sanitize_term()
and sanitize_term_field()
.
...
Fixes #17646 . Adds unit tests.
Props simonwheatley, dd32, kovshenin.
Built from https://develop.svn.wordpress.org/trunk@26010
git-svn-id: http://core.svn.wordpress.org/trunk@25941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-05 01:19:11 +00:00
Helen Hou-Sandí
7fa704d972
Allow passing false
for the meta_box_cb
arg in register_taxonomy()
to turn off the meta box display entirely. fixes #21543 .
...
Built from https://develop.svn.wordpress.org/trunk@25948
git-svn-id: http://core.svn.wordpress.org/trunk@25907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-27 16:29:09 +00:00
Andrew Nacin
bba2a414a2
Fix the exclude_tree argument in get_terms(), which fixes the exclude argument in wp_list_categories().
...
This was a 3.7 regression caused by [25162].
props dd32.
see #25710 for trunk.
Built from https://develop.svn.wordpress.org/trunk@25933
git-svn-id: http://core.svn.wordpress.org/trunk@25892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-26 15:04:11 +00:00
Andrew Nacin
1d269541e2
Introduce register_taxonomy_for_object_type().
...
props leewillis77.
fixes #11058 .
Built from https://develop.svn.wordpress.org/trunk@25596
git-svn-id: http://core.svn.wordpress.org/trunk@25513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-24 02:54:08 +00:00
Andrew Nacin
377cf11bfb
Pass $taxonomies to two more filters in get_terms().
...
props johnbillion.
fixes #18754 .
Built from https://develop.svn.wordpress.org/trunk@25576
git-svn-id: http://core.svn.wordpress.org/trunk@25493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 18:39:09 +00:00
Andrew Nacin
5febb6045f
Introduce a meta_box_cb argument for register_taxonomy().
...
The specified callback function is used as the meta box callback for the taxonomy.
props garyc40, helen.
fixes #14206 .
Built from https://develop.svn.wordpress.org/trunk@25572
git-svn-id: http://core.svn.wordpress.org/trunk@25489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-23 17:12:10 +00:00
Scott Taylor
ae4cf7665a
Add @access private
to _get_custom_object_labels()
, which was already implied by the dangling underscore. Cast $labels
to array
in get_taxonomy_labels()
and _get_custom_object_labels()
.
...
Props nacin, foofy.
Fixes #16310 .
Built from https://develop.svn.wordpress.org/trunk@25553
git-svn-id: http://core.svn.wordpress.org/trunk@25473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-21 17:44:09 +00:00
Scott Taylor
2d323d43e1
Ensure that terms with a post count of 0
are not returned in wp_count_terms()
when hide_empty => true
. Adds unit test which ensures that wp_count_terms()
returns 0
.
...
Props markjaquith.
Fixes #15919 .
Built from https://develop.svn.wordpress.org/trunk@25551
git-svn-id: http://core.svn.wordpress.org/trunk@25471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-21 16:48:10 +00:00
Drew Jaynes
00ca46973c
Clarify error handling and special cases in the wp_insert_term()
phpdoc block.
...
props lgedeon, SergeyBiryukov. See #22801 .
Built from https://develop.svn.wordpress.org/trunk@25498
git-svn-id: http://core.svn.wordpress.org/trunk@25419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-19 16:09:10 +00:00
Sergey Biryukov
8d2764fbd3
Update inline documentation for wp_insert_term().
...
props DrewAPicture.
fixes #22801 .
Built from https://develop.svn.wordpress.org/trunk@25489
git-svn-id: http://core.svn.wordpress.org/trunk@25410 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-19 01:57:10 +00:00
Scott Taylor
6ea9e9692d
Use wp_parse_args()
again for $args['rewrite']
in register_taxonomy()
.
...
Props SergeyBiryukov.
Fixes #23668 .
Built from https://develop.svn.wordpress.org/trunk@25483
git-svn-id: http://core.svn.wordpress.org/trunk@25404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-18 20:39:09 +00:00
Scott Taylor
072b0f2128
Use reset()
to access the first element of an array, don't assume there is an item at index 0
.
...
See #25282 .
Built from https://develop.svn.wordpress.org/trunk@25384
git-svn-id: http://core.svn.wordpress.org/trunk@25323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-12 05:09:09 +00:00
Scott Taylor
6fb5ef65c0
Avoid a notice by casting $args['rewrite']
to array()
before adding a slug
property and running array_merge()
.
...
Fixes #23668 .
Built from https://develop.svn.wordpress.org/trunk@25351
git-svn-id: http://core.svn.wordpress.org/trunk@25313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-11 17:17:11 +00:00
Scott Taylor
cb982c66ac
Don't call sanitize_title_with_dashes( $taxonomy )
in register_taxonomy()
unless $args['rewrite']['slug']
is empty.
...
Props SergeyBiryukov.
Fixes #23668 .
Built from https://develop.svn.wordpress.org/trunk@25335
git-svn-id: http://core.svn.wordpress.org/trunk@25297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-11 00:09:10 +00:00
Scott Taylor
7c2e7f8995
Add term_taxonomy_id
to available fields in get_term_by()
. Adds unit test.
...
Props jchristopher.
Fixes #21651 .
Built from https://develop.svn.wordpress.org/trunk@25334
git-svn-id: http://core.svn.wordpress.org/trunk@25296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-11 00:02:08 +00:00
Scott Taylor
d041c830bc
Avoid database error when include
or exclude
is not really a term_id
. Adds more unit tests.
...
Props kovshenin.
Fixes #11823 .
Built from https://develop.svn.wordpress.org/trunk@25257
git-svn-id: http://core.svn.wordpress.org/trunk@25225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 17:15:09 +00:00
Scott Taylor
6895dc9f8e
Introduce description__like
arg to get_terms()
. Make description__like
and name__like
perform LIKE
s with a wildcard on both sides of passed string. Previously, strings had to match the beginning of the name, so searching for burrito
in This is a burrito
would fail. Adds unit tests.
...
Props aaroncampbell for the original patch, 5 years ago.
Fixes #8214 .
Built from https://develop.svn.wordpress.org/trunk@25241
git-svn-id: http://core.svn.wordpress.org/trunk@25211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 19:41:08 +00:00
Scott Taylor
7c1ea6c95c
No need to re-map the return values of wp_parse_id_list()
to int.
...
See #22074 , #11823 .
Built from https://develop.svn.wordpress.org/trunk@25169
git-svn-id: http://core.svn.wordpress.org/trunk@25145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 18:54:09 +00:00
Scott Taylor
29952baa41
Search term name
and slug
when the search
arg is passed to get_terms()
. Adds unit test.
...
Props wojtek.szkutnik.
Fixes #13992 .
Built from https://develop.svn.wordpress.org/trunk@25164
git-svn-id: http://core.svn.wordpress.org/trunk@25143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 16:50:09 +00:00
Scott Taylor
4b449d38b4
Improve the include / exclude SQL generation in get_terms()
by using IN
and NOT IN
where applicable. Adds unit tests for include / exclude.
...
Props sirzooro, duck_.
Fixes #11823 .
Built from https://develop.svn.wordpress.org/trunk@25162
git-svn-id: http://core.svn.wordpress.org/trunk@25141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 16:24:09 +00:00
Scott Taylor
2f2f50c659
Support id=>name
and id=>slug
values for fields
arg in get_terms()
. Adds unit tests.
...
Props mikeschinkel.
Fixes #13661 .
Built from https://develop.svn.wordpress.org/trunk@25161
git-svn-id: http://core.svn.wordpress.org/trunk@25140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-29 15:19:10 +00:00
Andrew Nacin
732f176943
Pass $taxonomies to the get_terms_orderby filter.
...
props johnbillion.
fixes #18754 .
Built from https://develop.svn.wordpress.org/trunk@25142
git-svn-id: http://core.svn.wordpress.org/trunk@25122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-27 21:06:09 +00:00
Dominik Schilling
8688857816
Introduce show_in_menu for register_taxonomy.
...
Accepts boolean: true to show, false to hide. If not set, the default is inherited from show_ui.
fixes #20930 .
Built from https://develop.svn.wordpress.org/trunk@25133
git-svn-id: http://core.svn.wordpress.org/trunk@25113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-26 22:35:10 +00:00
Dominik Schilling
357f52eed7
Improve inline docs for register_post_type() and register_taxonomy().
...
* register_taxonomy: Use the same doc format for the associative array arg as used for register_post_type()
* register_taxonomy: Improve docs for _builtin, capabilities, hierarchical and rewrite args
* register_taxonomy: Use the same order in $defaults as in docblock
* register_taxonomy: Replace is_null with null ===, to be consistent
* register_post_type: Use the same order in $defaults as in docblock
* register_post_type: Improve docs for @uses and default fallbacks
And while we're on it: Whitespaces.
fixes #25150 .
Built from https://develop.svn.wordpress.org/trunk@25130
git-svn-id: http://core.svn.wordpress.org/trunk@25110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-26 20:24:08 +00:00
Scott Taylor
a97dfd3009
Use reset()
to grab the first taxonomy in an array, not by numerical index. Cleans up whitespace. Props webord, nbachiyski. Fixes #23506 .
...
Built from https://develop.svn.wordpress.org/trunk@25108
git-svn-id: http://core.svn.wordpress.org/trunk@25090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-23 21:29:10 +00:00
Scott Taylor
22c59d9c45
Check term_id
against the $term
object, not the non-existent var $args
. Props rboren. Fixes #12729 .
...
Built from https://develop.svn.wordpress.org/trunk@25106
git-svn-id: http://core.svn.wordpress.org/trunk@25088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-23 21:05:09 +00:00
Andrew Nacin
ac1f98d4ce
Add description argument to register_taxonomy().
...
props aaronholbrook.
fixes #24808 .
git-svn-id: http://core.svn.wordpress.org/trunk@24833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 23:01:56 +00:00
Andrew Nacin
cd47b3dc90
Add $taxonomy to edit_terms and edited_terms actions. props SergeyBiryukov, fixes #22542 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@24829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-28 22:15:03 +00:00
Andrew Nacin
4fd4d4452f
Use sanitize_key() instead of esc_sql() when 'escaping' variable DB field names. see #21767 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@24714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-16 14:21:05 +00:00
Ryan Boren
ad4a081c0c
Pinking shears
...
git-svn-id: http://core.svn.wordpress.org/trunk@24303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-20 12:10:58 +00:00
Sergey Biryukov
53d52e7cd5
Correct inline docs for wp_delete_term(). fixes #24343 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@24261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-15 08:10:52 +00:00
Sergey Biryukov
4b4b35ae3b
Remove unnecessary error suppression from get_terms(). fixes #21887 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@23599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 02:52:43 +00:00
Sergey Biryukov
b35c629308
Fix array formatting. props WraithKenny. fixes #21210 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@23598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-04 02:48:20 +00:00
Ryan Boren
315bfb019a
Use wp_unslash() instead of stripslashes() and stripslashes_deep(). Use wp_slash() instead of add_magic_quotes().
...
see #21767
git-svn-id: http://core.svn.wordpress.org/trunk@23594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 21:11:40 +00:00
Ryan Boren
43a7e695e9
Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
...
git-svn-id: http://core.svn.wordpress.org/trunk@23554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:28:40 +00:00
Sergey Biryukov
e58f456cb1
Make wp_remove_object_terms() return false if nothing has been deleted. props kovshenin. fixes #15475 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@23552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-01 16:22:07 +00:00
Sergey Biryukov
5777e5a949
Rename 'no_tagcloud' taxonomy label to 'not_found', for consistency with the post type label of the same key. fixes #23597 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@23484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-25 19:39:38 +00:00
Sergey Biryukov
bf1ca6b9ca
Move 'no_tagcloud' argument to the taxonomy labels object. props DrewAPicture for initial patch. fixes #23597 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@23483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-25 18:35:05 +00:00
Ryan Boren
cc5ed3a485
Change all core API to expect unslashed rather than slashed arguments.
...
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.
Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.
Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.
Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.
Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.
Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.
Plugins should use wp_unslash() on data being passed to core API.
Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.
Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.
Remove many no longer necessary calls to $wpdb->escape() and esc_sql().
In wp_get_referer() and wp_get_original_referer(), return unslashed data.
Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.
Switch several queries over to prepare().
Expect something to break.
Props alexkingorg
see #21767
git-svn-id: http://core.svn.wordpress.org/trunk@23416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 22:51:06 +00:00
Ryan Boren
353ef064ea
Use microtime() instead of incrementors for last_changed to to avoid race conditions with cache evictions.
...
Props westi
fixes #23448
git-svn-id: http://core.svn.wordpress.org/trunk@23401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-11 18:08:14 +00:00
Mark Jaquith
6953fe2a25
Introduce wp_remove_object_terms() and wp_add_object_terms(). No more fetch-alter-update nonsense. Use wp_remove_object_terms() in a few places internally.
...
props simonwheatley, scribu, ericmann, maxcutler. fixes #15475
git-svn-id: http://core.svn.wordpress.org/trunk@23398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-08 18:45:34 +00:00
Ryan Boren
0f80568a7e
Use incrementors for cache invalidation in get_terms().
...
fixes #23326
see #23173
git-svn-id: http://core.svn.wordpress.org/trunk@23384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-04 13:48:46 +00:00
Ryan Boren
b237423e72
Clear the object term relationships cache in wp_set_object_terms() rather than wp_set_post_terms(). This should be done lower in the stack than wp_set_post_terms().
...
Props batmoo
fixes #22560
git-svn-id: http://core.svn.wordpress.org/trunk@22878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 19:42:38 +00:00
Ryan Boren
06ee370814
Pinking shears
...
git-svn-id: http://core.svn.wordpress.org/trunk@22634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-17 15:11:29 +00:00
Andrew Nacin
1b0a4561a4
Use correct variable. props picklewagon. fixes #22394 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 00:16:30 +00:00
Andrew Nacin
039279db28
Only call wp_get_object_terms() if get_object_term_cache() says there is no cache (false), which is different than no terms. props wonderboymusic, fixes #16505 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 20:00:51 +00:00
Andrew Nacin
711f6f2619
Treat a single taxonomy passed as an array the same as when passed as a string in get_terms(). props wonderboymusic, fixes #17955 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 09:03:40 +00:00
Jon Cave
391ff2f639
Fix documentation typo: s/WP_Erorr/WP_Error/. See #21593 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 22:29:37 +00:00
Ryan Boren
28461df188
Return WP_Error when registering a taxonomy that exceeds 32 characters.
...
Props ocean90.
fixes #21593
git-svn-id: http://core.svn.wordpress.org/trunk@22307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 22:12:02 +00:00
Ryan Boren
77518e9c71
Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865
...
git-svn-id: http://core.svn.wordpress.org/trunk@22118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 20:00:16 +00:00
Ryan Boren
faca571a3a
Avoid 'Only variables should be assigned by reference' warning. Props wonderboymusic. see #21865
...
git-svn-id: http://core.svn.wordpress.org/trunk@22114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 18:21:47 +00:00
Ryan Boren
3c2b9a6901
An empty taxonomy query should return no results rather than all posts. Props wonderboymusic. fixes #20604
...
git-svn-id: http://core.svn.wordpress.org/trunk@22109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 13:16:47 +00:00
Andrew Nacin
557d9313a7
Introduce constants to allow for easier expression of time periods in seconds. Adds MINUTE_IN_SECONDS, HOUR_IN_SECONDS, DAY_IN_SECONDS, WEEK_IN_SECONDS, YEAR_IN_SECONDS. props nbachiyski, SergeyBiryukov. fixes #20987 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-25 05:26:19 +00:00
Andrew Nacin
d80d004b10
Don't repeatedly call get_object_taxonomies() in clean_object_term_cache(). see #11399 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-22 15:21:30 +00:00
Ryan Boren
df21fa1cc6
Pass a term object to the delete_term actions. Props bigdawggi. fixes #20645
...
git-svn-id: http://core.svn.wordpress.org/trunk@21939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-21 13:27:56 +00:00
Andrew Nacin
8203ef4905
Make WP_Tax_Query::transform_query() public. props scribu. fixes #21684 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-15 20:17:03 +00:00
Andrew Nacin
e728ad3a1e
Update docs to reflect that wp_count_terms() can return WP_Error when the taxonomy does not exist. props SergeyBiryukov, fixes #21888 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-14 16:11:30 +00:00
Ryan Boren
f483a85676
Remove unnecessary return by refs. Props wonderboymusic. fixes #21839
...
git-svn-id: http://core.svn.wordpress.org/trunk@21792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-10 17:00:11 +00:00
Andrew Nacin
1af8c36086
Allow easy registration of taxonomy columns on post (and custom post type) list table screens.
...
To register a column for a list table, use the new manage_taxonomies_for_{$post_type}_columns
filter. Introduces show_admin_column => true for register_taxonomy(), which automatically
displays that column on all associated post types.
props jtsternberg, SergeyBiryukov for initial patches.
fixes #21240 .
git-svn-id: http://core.svn.wordpress.org/trunk@21788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-08 03:18:36 +00:00
Ryan Boren
2b47dd4afe
Return WP_Error if the db insert in wp_set_object_terms() fails. Props jndetlefsen. fixes #21800
...
git-svn-id: http://core.svn.wordpress.org/trunk@21766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-05 17:57:53 +00:00
Andrew Nacin
5a9193d6c9
Validate $order in wp_get_object_terms(). props duck_.
...
git-svn-id: http://core.svn.wordpress.org/trunk@21758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-05 01:23:53 +00:00
Ryan Boren
f56d8278bb
Remove return ref from all calls to get_post()
...
Return WP_Post from get_default_post_to_edit()
Replace all calls to get_page() with get_post()
see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 20:01:10 +00:00
Ryan Boren
9377523bce
Introduce WP_Post class. Clean up ancestors handling. Props scribu, toppa. fixes #10381 see #21309
...
git-svn-id: http://core.svn.wordpress.org/trunk@21559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 19:47:52 +00:00
Ryan Boren
9dbb6a34f6
Reduce calls to sanitize_title_with_dashes in register_(post_type|taxonomy). Props ocean90. fixes #21600
...
git-svn-id: http://core.svn.wordpress.org/trunk@21553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 17:25:06 +00:00
Andrew Nacin
9eeccc2230
Add term_taxonomy_id field handling to WP_Tax_Query::transform_query(), allowing the transformation to be bypassed when tt ids are passed.
...
props wonderboymusic.
fixes #21228 .
git-svn-id: http://core.svn.wordpress.org/trunk@21552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-20 16:49:21 +00:00
Andrew Nacin
84c3a86036
Hide the link manager from the UI on upgrade, if the site has no links. New DB option, link_manager_enabled.
...
Enforce this by denying the 'manage_links' capability, which hides the All Links, Add New Link, and Link Categories screens. Hide WP_Widget_Links and the UI for the default_link_category as well.
Convert all references to 'posts and links' when handling reassignment on user deletion to just 'posts'.
see #21307 .
git-svn-id: http://core.svn.wordpress.org/trunk@21501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-13 16:18:42 +00:00
ryan
eaa419dba3
Consolodate some strings. Props pavelevap. fixes #20809
...
git-svn-id: http://core.svn.wordpress.org/trunk@20972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-01 19:05:30 +00:00
nacin
2243e45a43
Add view_item to the phpdoc for get_taxonomy_labels(). props Caspie. fixes #20406 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@20436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 20:08:30 +00:00
nacin
0730535015
Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@20287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-24 15:24:31 +00:00
duck_
a395e06896
Reduce references to the $wp_rewrite global because it's no longer used or a wrapper function can be used instead. Fixes #14546.#14546.
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@20023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 20:29:33 +00:00
duck_
8ac3015ccf
Stop invalid SQL syntax by bailing from wp_get_object_terms() if $object_ids or $taxonomies is empty. Props batmoo. Fixes #19952 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-21 20:20:50 +00:00
duck_
ecdac4be4f
Taxonomy rewrite generation when turning on permalinks, r18443 for taxonomies. Props SergeyBiryukov. Fixes #19794 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-15 17:30:37 +00:00
duck_
312e1f1811
Post formats should show_in_nav_menus when the current theme supports them. Props filosofo, nacin. Fixes #16390 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 17:12:02 +00:00
duck_
2f4c545761
Use new $args parameter for (WP_Rewrite::)add_permastruct(). Fixes #16092 .
...
Use array_intersect_key() to keep WP_Rewrite::$extra_permastructs free of unnecessary/unknown keys + values.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 21:00:59 +00:00
nacin
774e51c04c
Correct logic inversion. #19275 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-23 20:10:01 +00:00
nacin
0c224cd82c
Clean up and better document create_initial_taxonomies(). see #19275 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-23 19:58:26 +00:00
nacin
61abfcd3c7
Add 'ep_mask' as an argument to the 'rewrite' array for register_post_type() and register_taxonomy(). Keeps 'permalink_epmask' compatible as an argument for post type registrations. Fixes endpoints for category and tag pages. fixes #19275 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-23 19:12:04 +00:00
ryan
2b44b1a244
Update register_taxonomy_for_object_type() phpdoc to reflect that the post_type must be a string only, no arrays allowed. Props transom. fixes #19795
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-11 21:39:01 +00:00
ryan
4cf5450a81
Use wp_cache_add() instead of wp_cache_set() when priming the object term cache in update_object_term_cache(). Pass the real post_type to clean_object_term_cache() instead of hard-coding post. Call clean_object_term_cache() from clean_bookmark_cache(). Props leewillis77. fixes #19690
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-11 21:26:18 +00:00
ryan
616c35e71c
One newline is enough.
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:10:39 +00:00
ryan
85304c2dc7
Introduce term_is_ancestor_of(). Finish taxonomy support for wp_insert_category(). Props garyc40. fixes #15581
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-04 22:44:19 +00:00
nacin
03d21f6606
term_exists() @return correction. props johnbillion, fixes #19565 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-16 20:56:14 +00:00
ryan
07ff8b216b
Use one space, not two, after trailing punctuation. fixes #19537
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
ryan
39dc973965
Avoid undefined index notices. Props SergeyBiryukov, valendesigns. fixes #18455
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@19077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-28 19:52:14 +00:00