Commit Graph

165 Commits

Author SHA1 Message Date
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
John Blackbourn
f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn
3caaa40fc6 Docs: Switch more docs over to typed array notation, plus some fixes.
See #48303, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@46393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:09:04 +00:00
K. Adam White
9457896429 REST API: Issue warning if array meta is registered without item schema.
The purpose of meta registration is to assert that the meta key will contain a predictable value conforming to a schema, so the schema is therefore considered to be required.

Props TimothyBlynJacobs, grapplerulrich.
Fixes #43392.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 14:36:55 +00:00
John Blackbourn
640c90d35d Docs: Correct and improve inline docs relating to caching, terms, meta, and some misc tweaks.
See #47110   

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


git-svn-id: http://core.svn.wordpress.org/trunk@45726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-30 11:36:08 +00:00
K. Adam White
aa90dc4e8c Docs: Clarify custom-fields support requirement for viewing custom post meta in REST API.
Fixes #47866.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-13 01:51:56 +00:00
Gary Pendergast
a571a7d621 Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.
PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.



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


git-svn-id: http://core.svn.wordpress.org/trunk@45450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-15 06:25:57 +00:00
Gary Pendergast
4803fc405e Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-includes.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
John Blackbourn
8f5d82df7b Options, Meta APIs: Ensure the $object_id parameter passed to the delete_{$meta_type}_meta and deleted_{$meta_type}_meta filters is always an integer.
Props salcode

Fixes #43561

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


git-svn-id: http://core.svn.wordpress.org/trunk@44873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-28 21:59:52 +00:00
John Blackbourn
c155b2a833 Docs: Improve the documentation for metadata related filter parameters.
See #46543

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


git-svn-id: http://core.svn.wordpress.org/trunk@44845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-27 17:10:53 +00:00
Jeremy Felt
2dce718157 REST API: Move object type-specific metadata integrations from the wrapper functions to the low-level Meta API functions.
Object type-specific actions that should happen before or after modification of metadata have so far been part of the respective wrapper functions. By using action and filter hooks, this changeset ensures they are always executed, even when calling the lower-level Meta API functions directly, which the REST API does as a prime example.

Merges [43729] to trunk.

Props flixos90, spacedmonkey.
Fixes #44467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-12 03:02:24 +00:00
John Blackbourn
47d32decd6 Docs: Correct and improve various inline documentation.
See #42505

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


git-svn-id: http://core.svn.wordpress.org/trunk@43411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-27 14:28:26 +00:00
Gary Pendergast
56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +00:00
Rachel Baker
64bcc842af Docs: Update $meta_type descriptions to include ’term’ as a valid type in meta.php and class-wp-term-query.php.
Props macbookandrew.
Merges [43557] to trunk.
Fixes #44751.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-08 21:45:24 +00:00
K. Adam White
5f7e85d589 Docs: Add $object_subtype param documentation for sanitize_meta().
Props timothyblynjacobs.

See #38323.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-23 17:14:26 +00:00
K. Adam White
a7735117b6 Docs: Update @since version to 4.9.8 for meta registration subtype handling.
This feature has been backported to 4.9.8 so 5.0.0 is inaccurate.

See #38323.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-23 17:02:25 +00:00
Sergey Biryukov
efafeed66c Docs: Add missing backtick in delete_metadata() DocBlock.
Props dilipbheda, cliffpaulick.
Fixes #44433.
Built from https://develop.svn.wordpress.org/trunk@43385


git-svn-id: http://core.svn.wordpress.org/trunk@43213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-07-02 17:58:27 +00:00
K. Adam White
a89c86c711 REST API: Support meta registration for specific object subtypes.
Introduce an `object_subtype` argument to the args array for `register_meta()` which can be used to limit meta registration to a single subtype (e.g. a custom post type or taxonomy, vs all posts or taxonomies).

Introduce `register_post_meta()` and `register_term_meta()` wrapper methods for `register_meta` to provide a convenient interface for the common case of registering meta for a specific taxonomy or post type. These methods work the way plugin developers have often expected `register_meta` to function, and should be used in place of direct `register_meta` where possible.

Props flixos90, tharsheblows, spacedmonkey.
Fixes #38323.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:43:21 +00:00
John Blackbourn
d488e773b0 Docs: Update the inline docs for is_protected_meta().
See #42505

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


git-svn-id: http://core.svn.wordpress.org/trunk@42872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-30 14:39:21 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Gary Pendergast
a2693fd860 Database: Restore numbered placeholders in wpdb::prepare().
[41496] removed support for numbered placeholders in queries send through `wpdb::prepare()`, which, despite being undocumented, were quite commonly used.

This change restores support for numbered placeholders (as well as a subset of placeholder formatting), while also adding extra checks to ensure the correct number of arguments are being passed to `wpdb::prepare()`, given the number of placeholders.

See #41925.


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


git-svn-id: http://core.svn.wordpress.org/trunk@41885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-31 12:00:49 +00:00
Ryan McCue
3ecfb4b222 Options/Meta: Document valid types for registration.
In 4.7, the REST API introduced types for options and meta passed into the registration functions. This adds the documentation for those types.

Props iandunn, priyankabehera155.
Fixes #40318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-10 06:10:43 +00:00
Aaron Jorbin
1aae56f53a Update link in register_meta about 4.6 changes
The blog post, while originally canonical, was later updated to include additional changes. The ticket includes all the changes and alot of rational for why things changed.

Props Mista-Flo, DrewAPicture, morganestes.
Fixes #38254.


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


git-svn-id: http://core.svn.wordpress.org/trunk@39008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-01 06:54:34 +00:00
Peter Wilson
3c814b5468 Meta: Improve ID casting when getting, updating or deleting meta data.
Blindly casting IDs to absolute integers in `get_metadata_by_mid()`, `update_metadata_by_mid()` and `delete_metadata_by_mid()` can cause unexpected behaviour when a floating or negative number is passed.

Fixes #37746.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-01 06:28:30 +00:00
Drew Jaynes
e6267dcf19 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 2/2.

Fixes #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 19:33:30 +00:00
Jeremy Felt
65ffc1ff42 Meta: Ensure $wp_meta_keys is an array in get_registered_meta_keys().
Props vishalkakadiya.
Fixes #37415, See #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-19 21:59:44 +00:00
Jeremy Felt
30851d1186 Meta: Remove object subtype handling from register_meta().
Registration is now based solely on object type, which allows the code around this to be simplified significantly.

In the process of making this adjustment:

* `register_meta()`, `unregister_meta_key()`, `get_registered_metadata()`, and `registered_meta_key_exists()` no longer return `WP_Error` objects.
* The recently introduced `wp_object_type_exists()` function and the restriction on object type has been removed.

Note: No guarantee of uniqueness is made across object subtypes. Registered meta keys should be uniquely prefixed to avoid conflict.

Fixes #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-18 21:16:29 +00:00
Jeremy Felt
da40e89d06 Meta: Ensure filters are backwards compatible for pre-4.6 style meta registration.
When using `register_meta()` with the function signature from 4.5 and earlier, the `auth_{$type}_meta_{$key}` and `sanitize_{$type}_meta_{$key}` filters are used. Any calls to `register_meta()` expecting this behavior should continue to work. The new filters, which take advantage of object subtypes, should not be added unless the proper `$args` array is passed.

See #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 04:46:28 +00:00
Jeremy Felt
d5e14166f3 Meta: Remove filters when meta is unregistered.
If auth and/or sanitize callbacks are specified in the arguments for
`register_meta()`, filters are added to handle these callbacks. These
should be removed when calling `unregister_meta_key()` to avoid
unintentional filtering.

See #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 04:13:30 +00:00
Drew Jaynes
4c029e870e Docs: Link the 4.6 changelog entry in the DocBlock for register_meta() to its corresponding dev note on make/core.
h/t ocean90.

See #35658. See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-09 16:50:35 +00:00
Jeremy Felt
b69192f9ec Meta: Don't pass an empty $meta_key to get_metadata().
This doesn't break anything, but also isn't necessary.

Props sc0ttkclark.
See #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-07 00:18:27 +00:00
Helen Hou-Sandí
5a2ffe61f6 Meta: Make registration error conditions return consistently.
In doing this, non-core object types are no longer forcibly blocked and are instead checked against `wp_object_type_exists()` which has a filterable return value. Still, filter that at your own risk.

props Faison for the initial patch.
see 35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 18:09:32 +00:00
Jeremy Felt
dc57f35048 Meta: Ensure $object_subtype is available before use in register_meta().
Props sc0ttkclark.
See #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 18:01:30 +00:00
Helen Hou-Sandí
7f5717ba5d Meta: Make retrieving registered metadata actually work.
The initial implementation used a `single` argument, which has now been added to the whitelist.

props Faison.
see #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-30 21:25:27 +00:00
Helen Hou-Sandí
42854ca56f Meta registration: Ensure $args is an array and simplify compat logic.
props ocean90, sc0ttkclark.
see #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-30 19:00:31 +00:00
Helen Hou-Sandí
48ca588a6c Meta: Actually use fallback auth for the previous registration method.
see #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-30 16:39:29 +00:00
Helen Hou-Sandí
69ccab3405 Introduce an expanded meta registration API.
`register_meta()` has been altered to accept an array of arguments as the third parameter in order to support its usage beyond XML-RPC, notably in the REST API and other projects that may build on top of meta, such as a potential Fields API. Arguments are whitelisted to reserve the right for core to add more later.

New functions added to complement this expansion are:
* `registered_meta_key_exists()`
* `unregister_meta_key()`
* `get_registered_meta_keys()`
* `get_registered_metadata()`
* A "private" function for the aforementioned whitelisting.

There still need to be lots of tests written for previous and new behaviors, and many things are subject to change. Maybe things will explode. #yolo

props jeremyfelt, ericlewis, sc0ttkclark, helen, rmccue, ocean90, voldemortensen.
see #35658.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-30 01:02:29 +00:00
Drew Jaynes
9cb5247392 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:50:28 +00:00
Drew Jaynes
a89fee749a Docs: Improve the DocBlock summary for wp_metadata_lazyloader(), introduced in [36566].
See #35816. See #35986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 17:50:27 +00:00
Boone Gorges
571e14f897 More performance improvements to metadata lazyloading.
Comment and term meta lazyloading for `WP_Query` loops, introduced in 4.4,
depended on filter callback methods belonging to `WP_Query` objects. This meant
storing `WP_Query` objects in the `$wp_filter` global (via `add_filter()`),
requiring that PHP retain the objects in memory, even when the local variables
would typically be expunged during normal garbage collection. In cases where a
large number of `WP_Query` objects were instantiated on a single pageload,
and/or where the contents of the `WP_Query` objects were quite large, serious
performance issues could result.

We skirt this problem by moving metadata lazyloading out of `WP_Query`. The
new `WP_Metadata_Lazyloader` class acts as a lazyload queue. Query instances
register items whose metadata should be lazyloaded - such as post terms, or
comments - and a `WP_Metadata_Lazyloader` method will intercept comment and
term meta requests to perform the cache priming. Since `WP_Metadata_Lazyloader`
instances are far smaller than `WP_Query` (containing only object IDs), and
clean up after themselves far better than the previous `WP_Query` methods (bp
only running their callbacks a single time for a given set of queued objects),
the resource use is decreased dramatically.

See [36525] for an earlier step in this direction.

Props lpawlik, stevegrunwell, boonebgorges.
Fixes #35816.
Built from https://develop.svn.wordpress.org/trunk@36566


git-svn-id: http://core.svn.wordpress.org/trunk@36533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 22:58:26 +00:00
Boone Gorges
3e9c88d75a In delete_metadata(), only invalidate cache for affected objects.
The `$delete_all` flag in `delete_metadata()` triggers cache invalidation for
multiple objects. Previously, invalidation took place for all objects matching
the `$meta_key` parameter, regardless of whether `$meta_value` was also set.
This resulted in overly aggressive invalidation.

Props rahal.aboulfeth.
Fixes #35797.
Built from https://develop.svn.wordpress.org/trunk@36511


git-svn-id: http://core.svn.wordpress.org/trunk@36478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-12 02:47:26 +00:00
Boone Gorges
1370d8b869 Don't double-unslash meta key when update_metadata() falls back on add_metadata().
Props jdgrimes.
Fixes #35795.
Built from https://develop.svn.wordpress.org/trunk@36509


git-svn-id: http://core.svn.wordpress.org/trunk@36476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-11 17:35:28 +00:00
Boone Gorges
bb6a068e29 Simplify action placement in update_metadata().
By combining a number of `foreach` loops, we make the code more readable and
potentially faster in the case where many metadata rows are being updated.

Props Shelob9.
Fixes #35652.
Built from https://develop.svn.wordpress.org/trunk@36420


git-svn-id: http://core.svn.wordpress.org/trunk@36387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-29 04:52:28 +00:00
Sergey Biryukov
bc1e479fd0 After [35718], update the location of some files in This filter is documented in docs.
Partially reverts [33954].

Fixes #33413.
Built from https://develop.svn.wordpress.org/trunk@35725


git-svn-id: http://core.svn.wordpress.org/trunk@35689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-22 03:51:28 +00:00
Andrew Nacin
1579e45d41 Simplify the include graph after work to split out classes.
see #33413. More details there.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 07:24:30 +00:00
Drew Jaynes
df81151f24 Docs: Clarify the file header summary for wp-includes/meta.php, the top-level file for the core Meta API.
Also adds inline DocBlocks for files broken out in #33413 and now brought in via `require_once()`.

See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:30:24 +00:00
Scott Taylor
b6c01b80fa Meta: move WP_Meta_Query into its own file. meta.php loads the new files, so this is 100% BC if someone is loading meta.php directly. New files created using svn cp.
Creates: 
`class-wp-meta-query.php` 
`meta-functions.php` 

`meta.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 13:02:21 +00:00
Drew Jaynes
a7b38bf90a Docs: Correct the phpDoc type to a boolean for the $single parameter in the get_{$meta_type}_metadata hook docs.
Props dlh.
Fixes #33451.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 19:36:25 +00:00
Drew Jaynes
6639c342a5 Fix inline documentation syntax in the DocBlock for WP_Meta_Query->has_or_relation(), added in 4.3.
See [32713]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 21:44:24 +00:00
Boone Gorges
5dfd6a02a7 Avoid returning duplicate matches when using a meta query in WP_User_Query.
A meta_query containing an `OR` relation can result in the same record matching
multiple clauses, leading to duplicate results. The previous prevention against
duplicates [18178] #17582 became unreliable in 4.1 when `WP_Meta_Query`
introduced support for nested clauses. The current changeset adds a new method
`WP_Meta_Query::has_or_relation()` for checking whether an `OR` relation
appears anywhere in the query, and uses the new method in `WP_User_Query` to
enforce distinct results as necessary.

Props maxxsnake.
Fixes #32592.
Built from https://develop.svn.wordpress.org/trunk@32713


git-svn-id: http://core.svn.wordpress.org/trunk@32683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-09 17:42:28 +00:00