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