Commit Graph

720 Commits

Author SHA1 Message Date
Jeremy Felt 6f3f00ea97 Multisite: Change `WP_Network` `id` property to an integer.
For consistency and developer sanity.

Props flixos90.
Fixes #37050.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:26:29 +00:00
Boone Gorges 8603aa402a Query: `set_found_posts()` must run immediately after main query.
If not run immediately after, the `SELECT FOUND_ROWS()` query might refer to
a different query, such as the one used to populate the post cache for a split
query.

Introduced in [37692].

Fixes #36687.
Built from https://develop.svn.wordpress.org/trunk@37721


git-svn-id: http://core.svn.wordpress.org/trunk@37687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-16 02:01:29 +00:00
Boone Gorges bd2fafae0a Query: After [37692], don't skip `set_found_posts()` when no posts are found.
The 'found_posts' filter must continue to run for plugins manipulating post
results via filter.

Props dd32.
Fixes #36687.
Built from https://develop.svn.wordpress.org/trunk@37712


git-svn-id: http://core.svn.wordpress.org/trunk@37678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-15 12:33:29 +00:00
Boone Gorges 486961626c Query: Allow plugins to supply post results instead of having `WP_Query` fetch them from the database.
Returning a non-null value from the new `posts_pre_query` filter will cause
`WP_Query` to skip its database query, so that posts data can be provided from
elsewhere. This is useful in cases where post data may be mirrored in a
separate location, such as an external search application.

Developers should note that the `WP_Query` properties generally used to
calculate pagination - specifically, `found_posts` and `max_num_pages`, which
are determined by default in `set_found_posts()` - must be provided explicitly
when using the `posts_pre_query` filter; since `WP_Query` will not be
contacting the database, it will have no access to `SELECT FOUND_ROWS()`.
The `WP_Query` instance is passed to `posts_pre_query` by reference, so that
these properties can be set manually if needed.

Props jpdavoutian, tlovett1.
Fixes #36687.
Built from https://develop.svn.wordpress.org/trunk@37692


git-svn-id: http://core.svn.wordpress.org/trunk@37658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-14 02:00:29 +00:00
Boone Gorges 7a9ed544e8 Allow term meta lazy-loading to be selectively disabled in `WP_Query`.
The process of lazy-loading can be resource intensive for object that have
terms in large numbers of taxonomies and are running a persistent object cache.
This new parameter allows the feature to be disabled in these cases.

Props DBrumbaugh10Up.
See #36953.
Built from https://develop.svn.wordpress.org/trunk@37589


git-svn-id: http://core.svn.wordpress.org/trunk@37557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-28 03:10:29 +00:00
Drew Jaynes 9193013158 Docs: Apply inline `@see` tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

Fixes #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 19:02:28 +00:00
Drew Jaynes 5ac8c4158c Docs: Standardize filter docs in wp-includes/query.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:35:54 +00:00
Drew Jaynes f52a8cb1fa Docs: Remove/replace invalid inline `@link` tags in DocBlocks in wp-includes/*.
Fixes #36910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:39:28 +00:00
Drew Jaynes b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
Drew Jaynes fe3b007fdd Docs: Remove inline `@see` tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Boone Gorges 9bf510260f Query: Discard non-scalar 'm' instead of attempting to sanitize.
`WP_Query` discards most non-array date values ('year', 'monthnum', etc) by
casting to integer. Since [25138], the 'm' parameter has been handled
as a string; see #24884. However, the string-handling introduced in [25138]
blindly attempted to handle arrays and other non-scalar types as strings,
resulting in PHP notices and invalid MySQL syntax.

Props vortfu.
Fixes #36718.
Built from https://develop.svn.wordpress.org/trunk@37324


git-svn-id: http://core.svn.wordpress.org/trunk@37290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-29 13:15:30 +00:00
Sergey Biryukov cf12011934 Docs: Move the clarification of `is_tax()` and `WP_Query::is_tax()` return value added in [37235] to `@return` description.
Props DrewAPicture.
Fixes #36331.
Built from https://develop.svn.wordpress.org/trunk@37281


git-svn-id: http://core.svn.wordpress.org/trunk@37247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-21 17:47:28 +00:00
Sergey Biryukov 2032e527b3 Docs: Clarify that `is_tax()` and `WP_Query::is_tax()` return false for built-in taxonomies (category and tag archives).
Props theMikeD.
Fixes #36331.
Built from https://develop.svn.wordpress.org/trunk@37235


git-svn-id: http://core.svn.wordpress.org/trunk@37201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-18 01:44:26 +00:00
Boone Gorges 54cf1d2c3d Query: Allow results to be ordered by `post_parent__in`.
Props postpostmodern.
Fixes #36515.
Built from https://develop.svn.wordpress.org/trunk@37225


git-svn-id: http://core.svn.wordpress.org/trunk@37191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-17 03:17:27 +00:00
Sergey Biryukov 4a5dea0d62 Canonical / Query: Restore the `is_404()` check in `wp_old_slug_redirect()` which was removed in [34659].
This reverts part of [34659] due to excessive canonical problems it's caused in 4.4.x.

Remove the unit tests which are no longer supported.
This also removes the `is_feed()` code to avoid confusion - only pages & embeds will be redirected.

Merges [36280] and [36281] to trunk.

Props dd32.
See #21602, #35344.
Built from https://develop.svn.wordpress.org/trunk@37075


git-svn-id: http://core.svn.wordpress.org/trunk@37042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-23 21:54:26 +00:00
Boone Gorges 036e63c31a Query: Ignore search terms consisting of a single dash.
Due to the "exclude" support added in WP 4.4, single dashes were being
converted to "NOT LIKE '%%'" clauses, causing all searches to fail.

Props RomSocial, swissspidy.
Fixes #36195.
Built from https://develop.svn.wordpress.org/trunk@36989


git-svn-id: http://core.svn.wordpress.org/trunk@36956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-14 14:12:25 +00:00
Aaron Jorbin 5ec9a2aeb4 Revert r36696
This broke embeds. Needs a better solution to also make sure all queries from the REST API aren't broken.

see #35907.



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


git-svn-id: http://core.svn.wordpress.org/trunk@36666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 22:12:25 +00:00
Aaron Jorbin ae9e63805d Permit sticky posts to affect the query in REST_REQUEST
Needed for https://github.com/WP-API/WP-API/issues/2210

Props danielbachhuber.
Fixes #35907.


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


git-svn-id: http://core.svn.wordpress.org/trunk@36663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 21:44:26 +00:00
Boone Gorges 6d8a3f3612 Query: Search should match `post_excerpt` in addition to title and content.
When ordering search results, exact matches in the post excerpt are weighted
above those in post content, but below those in the post title.

Props swissspidy, sebastian.pisula.
FIxes #35762.
Built from https://develop.svn.wordpress.org/trunk@36647


git-svn-id: http://core.svn.wordpress.org/trunk@36614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 20:14:26 +00:00
Boone Gorges ba5cc4e776 Query: Allow a seed value to be passed when using 'rand' `$orderby`.
`WP_Query` allows random ordering; `'orderby' => 'rand'` translates to
`ORDER BY RAND()`. This syntax results in random ordering that is not
consistent from request to request. MySQL supports the passing of a seed value
to random sorts, such as `ORDER BY RAND(3)`, which will return the same
random value each time it's called. `WP_Query` now supports this syntax, by
passing `RAND(3)` (or whatever integer seed value you'd like) as the value
of `'orderby'`.

Props hlashbrooke.
Fixes #35692.
Built from https://develop.svn.wordpress.org/trunk@36632


git-svn-id: http://core.svn.wordpress.org/trunk@36599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 16:40:26 +00:00
Boone Gorges 072c791df0 Query: `is_*( $int )` should not falsely match strings starting with "$int".
Another chapter in the Storied Annals of Weird `in_array()` Behavior:
`in_array( 4, array( "4-cool-dudes" ) );` resolves to `true`, such that
`is_page( 4 )` was returning true for posts with the name `'4-cool-dudes'`.

We work around this behavior by ensuring that values passed to the `is_`
methods are cast to strings before the `in_array()` checks. ID checks still
work as expected; see #24674.

Props mikejolley, swissspidy, boonebgorges.
Fixes #35902.
Built from https://develop.svn.wordpress.org/trunk@36625


git-svn-id: http://core.svn.wordpress.org/trunk@36592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-23 02:21:25 +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 60cf073672 Improve `WP_Query` lazyloading logic, for better performance.
Lazyloading for comment meta and term meta, introduced into `WP_Query` in
4.4, used flags - `updated_term_meta_cache` and `updated_comment_meta_cache` -
in an attempt to prevent cache priming from happening more than once per query
object. This technique was mostly effective, but not entirely efficient, since
the flag didn't prevent the `lazyload_*_meta` callbacks from running. The
obvious solution - removing the filter callback after it'd be run once - was
dismissed for 4.4 because of concerns that `remove_filter()` could disable
lazyloading too generally in the context of nested queries, due to the way
`_wp_filter_build_unique_id()` doesn't always build sufficiently unique IDs for
similar objects. However, further testing shows that this concern is only valid
in a very small subset of cases, while the cost of keeping the query objects in
memory, via the `$wp_filter` global, is quite significant. As such, this
changeset removes the flags in favor of the `remove_filter()` technique.

See #35454, #35816.
Built from https://develop.svn.wordpress.org/trunk@36524


git-svn-id: http://core.svn.wordpress.org/trunk@36491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-13 03:05:27 +00:00
Boone Gorges f1c0ed714a `WP_Query` taxonomy query vars should be set to first of multiple taxonomies.
This provides better parity with `get_queried_object()`, which will return the
first taxonomy/term matched by the current query.

[29891] introduced the abnormal behavior for the 'taxonomy' and 'term'
query vars.

Props Chouby.
Fixes #35619.
Built from https://develop.svn.wordpress.org/trunk@36484


git-svn-id: http://core.svn.wordpress.org/trunk@36451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-06 03:58:27 +00:00
Boone Gorges e6d2b6cab0 Query: Respect 'suppress_filters' when filtering search-related SQL.
Props 5um17.
Fixes #35594.
Built from https://develop.svn.wordpress.org/trunk@36404


git-svn-id: http://core.svn.wordpress.org/trunk@36371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-26 03:12:25 +00:00
Boone Gorges de89efc4dc Introduce `$comment_status` and `$ping_status` params for `WP_Query`.
Props birgire.
Fixes #35601.
Built from https://develop.svn.wordpress.org/trunk@36403


git-svn-id: http://core.svn.wordpress.org/trunk@36370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-26 02:56:26 +00:00
Pascal Birchler b0b13aff2f Embeds: Allow embedding static front pages and pages having a child page with an `embed` slug.
This makes `embed` a special slug that can't be used for new pages/posts. When `https://example.com/foo/embed/` is an existing page, embeds fall back to `https://example.com/foo/?embed=true`.
Adds unit tests.

Fixes #34971.
Built from https://develop.svn.wordpress.org/trunk@36307


git-svn-id: http://core.svn.wordpress.org/trunk@36274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 07:56:26 +00:00
Boone Gorges 2d74b18bea Support searching for `'0'` in `WP_Query`.
Props swissspidy.
See #31025.
Built from https://develop.svn.wordpress.org/trunk@36278


git-svn-id: http://core.svn.wordpress.org/trunk@36245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-13 04:37:25 +00:00
Boone Gorges cfae56d2c2 Avoid invalid SQL when building ORDER BY clause using long search strings.
The introduction of negative search terms in 4.4 [34934] introduced the
possibility that the ORDER BY clause of a search query could be assembled in
such a way as to create invalid syntax. The current changeset fixes this by
ensuring that the ORDER BY clause corresponding to the search terms is
excluded when it would otherwise be empty.

Props salvoaranzulla.
Fixes #35361.
Built from https://develop.svn.wordpress.org/trunk@36251


git-svn-id: http://core.svn.wordpress.org/trunk@36218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-10 03:26:26 +00:00
Rachel Baker 4aa970e0e8 Feeds: Comments on attachments display in the site-wide comments RSS feed.
Individual attachment pages already have their own RSS comment feed, and would be expected to be included in the site-wide comments RSS feed.

Props jbrinley. 
Fixes #15610


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


git-svn-id: http://core.svn.wordpress.org/trunk@36104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-31 17:16:27 +00:00
Gary Pendergast b23280fe49 Redirects: Prevent redirects if a queried object exists.
After [34659], it became possible to cause an incorrect redirect, by changing the slug of a post, then creating a new post with the old slug. The correct behaviour is to prevent redirecting to the old post.

Props dd32, pento.

Fixes #35031 for trunk.


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


git-svn-id: http://core.svn.wordpress.org/trunk@36094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-31 03:01:29 +00:00
Sergey Biryukov d160543282 Query: Remove a stray debug line from `WP_Query::get_posts()`.
Props dlh.
Fixes #35271.
Built from https://develop.svn.wordpress.org/trunk@36127


git-svn-id: http://core.svn.wordpress.org/trunk@36093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-31 02:23:30 +00:00
John Blackbourn 0003a004db Docs: Miscellaneous docblock code quality tweaks.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@36039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 07:53:26 +00:00
Drew Jaynes 3cba9d7f61 Docs: Add missing parameter descriptions to the DocBlock for `WP_Query::set_found_posts()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-16 18:11:26 +00:00
John Blackbourn b2e373d64d Correct the name of the `@param` doc for `WP_Query::parse_tax_query()`.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@35872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-14 02:08:26 +00:00
John Blackbourn a027edc277 Comments: The year is 2003. Permalinks are a new thing and everyone's using Blogger. It's a time when opening a modal window in JavaScript to view a section of a website is not a completely weird thing, although many users get annoyed by it. b2 has recently become WordPress, and with it comes a bunch of functionality that will become stale over the next decade, remnants of simpler times.
Twelve years later, after no fewer than three themes have intentionally implemented popup comments in their functionality, before being abandoned for at least the last six years, we've reached a time where we can put this era behind us. A time when we can remove comment popup functionality from WordPress.

If this breaks the internet, I'll eat my hat.

Fixes #28617

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


git-svn-id: http://core.svn.wordpress.org/trunk@35812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-10 03:06:30 +00:00
Boone Gorges 31219ee677 In `WP_Query`, set `is_home` to `false` during REST requests.
Props danielbachhuber.
Fixes #34373.
Built from https://develop.svn.wordpress.org/trunk@35690


git-svn-id: http://core.svn.wordpress.org/trunk@35654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 21:18:26 +00:00
Scott Taylor af0282891d Rewrite: alleviate conflicts between image attachment pages and posts when permalink structure is `/%postname%/`.
Adds unit test.

Props SergeyBiryukov.
Fixes #24612.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 19:59:25 +00:00
Drew Jaynes 7771205935 Query: Introduce the `content_pagination` filter, which makes it possible to manipulate how post content is split into "pages" in `WP_Query::setup_postdata()`.
The "pages" — or chunks of post content – are determined by splitting based on the presence of `<!-- nextpage -->` tags in the post content.

Props sirzooro, chriscct7.
Fixes #9911.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 06:33:27 +00:00
Drew Jaynes 217b661703 Docs: Add missing descriptions for the `$wpdb` global in DocBlocks all the places.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-14 23:44:25 +00:00
Boone Gorges 07b7e7b3c7 Remove dead code from `WP_Query::lazyload_term_meta()`.
Built from https://develop.svn.wordpress.org/trunk@35111


git-svn-id: http://core.svn.wordpress.org/trunk@35076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-13 02:36:25 +00:00
John Blackbourn 2dd5ad6327 Correct the `@since` doc for `WP_Query::is_embed()`.
See #32522

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


git-svn-id: http://core.svn.wordpress.org/trunk@35049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 22:13:25 +00:00
Boone Gorges c2a0d593ac Allow excluded keywords when searching posts.
Pass a keyword with a leading hyphen to exclude posts containing that keyword.
For example, 'taco -onions' will return posts that contain the word 'taco' but
do not contain the word 'onions'.

Props akibjorklund.
Fixes #33988.
Built from https://develop.svn.wordpress.org/trunk@34934


git-svn-id: http://core.svn.wordpress.org/trunk@34899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-08 03:18:24 +00:00
Gary Pendergast 83c3e3e00e Embeds: Add oEmbed provider support.
For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.

In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.

For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.

Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia

Fixes #32522.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-07 10:36:25 +00:00
John Blackbourn ab413e89bf Include `post__in` as a value available to the `orderby` parameter in the docs for `WP_Query::parse_query()`.
See #32246

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


git-svn-id: http://core.svn.wordpress.org/trunk@34801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 20:58:29 +00:00
Boone Gorges f6b2797bd3 Remove `search_terms` from `WP_Query` doc block.
It's not actually a query param.

Introduced in [28887].
Built from https://develop.svn.wordpress.org/trunk@34795


git-svn-id: http://core.svn.wordpress.org/trunk@34760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-03 04:36:27 +00:00
Boone Gorges 51ddf2ca9c Correct some `WP_Query` metadata lazyloading docs.
Props dlh.
Fixes #34047.
Built from https://develop.svn.wordpress.org/trunk@34732


git-svn-id: http://core.svn.wordpress.org/trunk@34696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 04:01:48 +00:00
Boone Gorges 80654eb17a s/`add_action()`/`add_filter()` in `WP_Query` metadata lazyloading.
Props dlh.
See #34047.
Built from https://develop.svn.wordpress.org/trunk@34731


git-svn-id: http://core.svn.wordpress.org/trunk@34695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 04:01:24 +00:00
Boone Gorges 654eeb3785 Improve lazyloading of comment meta in `WP_Query` loops.
Lazy-loading logic is moved to a method on `WP_Query`. This makes it possible
for comment feeds to take advantage of metadata lazyloading, in addition to
comments loaded via `comments_template()`.

This new technique parallels the termmeta lazyloading technique introduced in
[34704].

Fixes #34047.
Built from https://develop.svn.wordpress.org/trunk@34711


git-svn-id: http://core.svn.wordpress.org/trunk@34675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-30 01:35:26 +00:00
Boone Gorges db880777f4 Improve lazyloading of term metadata in `WP_Query` loops.
[34529] introduced lazyloading for the metadata belonging to terms matching
posts in the main `WP_Query`. The current changeset improves this technique
in the following ways:

* Term meta lazyloading is now performed on the results of all `WP_Query` queries, not just the main query.
* Fewer global variable touches and greater encapsulation.
* The logic for looping through posts to identify terms is now only performed once per `WP_Query`.

Props dlh, boonebgorges.
See #34047.
Built from https://develop.svn.wordpress.org/trunk@34704


git-svn-id: http://core.svn.wordpress.org/trunk@34668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-29 22:00:24 +00:00
Boone Gorges c36d4fb8a9 `WP_Query` should not ignore an offset of `0`.
Props mazurstas.
Fixes #34060.
Built from https://develop.svn.wordpress.org/trunk@34697


git-svn-id: http://core.svn.wordpress.org/trunk@34661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-29 19:37:23 +00:00
Gary Pendergast cf173408cd Permalinks: Add pretty permalinks for unattached attachments.
Previously, unattached attachments would have unsightly `/?attachment_id=1` URLs. As we've moved away from attachments being specifically attached to posts, instead being Media items, this has made the unattached URLs a more common occurrence.

We can breath easy once more, knowing that the world is a little bit safer from the horror of unnecessarily ugly URLs.

Props SergeyBiryukov, wonderboymusic, pento.

Fixes #1914.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-29 09:42:26 +00:00
Gary Pendergast 1db89dd3bf Rewrite: Redirect attachment URLs when their slug changes.
Using the same logic that we use to redirect posts when their slug changes, we can provide the same functionality for attachments. Attachment pages are posts, too.

Props swissspdy.

Fixes #34043.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-29 04:58:25 +00:00
Gary Pendergast 635d3bb34e Rewrite: When redirecting old slugs, include URL endpoints.
Historically, `wp_old_slug_redirect()` has only ever redirected the old slug of posts, it hasn't included URL endpoints, or worked with comment feed URLs. By adding support for these, we ensure a greater range of URLs aren't killed when the slug changes.

Props swissspdy.

Fixes #33920.


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


git-svn-id: http://core.svn.wordpress.org/trunk@34623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-28 06:57:26 +00:00
Drew Jaynes b818747870 Docs: Add more explicit optional parameter types and return descriptions in the DocBlocks for `is_page()`, `is_single()`, `is_singular()`.
Also adds explicit types and return descriptions to the corresponding `WP_Query` methods: `WP_Query::is_page()`, `WP_Query::is_single()`, and `WP_Query::is_singular()`.

Props Shelob9 for the initial patch.
Fixes #33907.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 16:18:24 +00:00
Scott Taylor e19e604a74 Docs: `is_main_query()`'s `_doing_it_wrong()` notice suggests using `WP_Query` statically (`WP_Query::is_main_query()`). Use an alternate syntax: `WP_Query->is_main_query()`, to not confuse.
Props DrewAPicture, micahwave.
Fixes #25680.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-21 15:31:26 +00:00
Scott Taylor cb54b8d5a7 WP Query: Avoid using HTML tags in translation strings, add translator strings.
Props ramiy.	
Fixes #31868.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-20 03:04:24 +00:00
Drew Jaynes f93dcf9226 Docs: Add descriptions for `$wp_query` global phpDoc references in wp-includes/query.php, partially documented in [32620].
Fixes #32139.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-20 00:05:26 +00:00
Drew Jaynes d870f4c9f9 Docs: Fix some syntactical issues in the DocBlock for `set_query_var()`.
Adds descriptions for the global `WP_Query` instance and the `$value` parameter.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-18 10:29:25 +00:00
Drew Jaynes 18adeb92fa Docs: Fix some syntactical issues in the documentation for `get_queried_object_id()`.
Adds descriptions for the global `WP_Query` instance and the return.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-18 10:27:24 +00:00
Drew Jaynes 7a73dfbfb6 Docs: Fix some syntactical isses in the DocBlock for `get_queried_object()`.
Also add descriptions for the return and the `WP_Query` global.

See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-18 10:21:26 +00:00
Drew Jaynes 05f4e52541 Docs: Add documentation to `get_query_var()` and `WP_Query::get()` for the optional `$default` argument, introduced in 3.9 in [27304].
Props swissspidy.
Fixes #33856.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-18 09:41:27 +00:00
Scott Taylor af593128a7 Revert [33925], by-reference array manipulation is breaking comments in some themes.
This implementation is losing its shine.

See #16894.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 18:14:25 +00:00
Boone Gorges c0a0d4ba50 Use stricter sanitization for meta query clause keys.
By forcing all clause keys to be strings, we make it possible to use strict
comparison when validating values of 'orderby' as passed to `WP_Query`. This
eliminates situations where the presence of numeric clause keys could result
in an improperly validated 'orderby' value.

Props nikolov.tmw.
Fixes #32937.
Built from https://develop.svn.wordpress.org/trunk@34090


git-svn-id: http://core.svn.wordpress.org/trunk@34058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 21:06:24 +00:00
Boone Gorges fc884dc7ec Allow `setup_postdata()` to accept a post ID.
Previously, it accepted only a full post object.

Props sc0ttclark, mordauk, wonderboymusic.
Fixes #30970.
Built from https://develop.svn.wordpress.org/trunk@34089


git-svn-id: http://core.svn.wordpress.org/trunk@34057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 20:58:23 +00:00
Boone Gorges 1a203b5328 Better default values in `WP_Query::get_queried_object()`.
Setting the default value of the `queried_object_id` property to `0` meant
that, when called early enough in the WP bootstrap, `get_queried_object()`
could short-circuit the normal query by fooling it into thinking that the
request was for a page with id 0. Setting the default value to `null` instead
avoids this problem.

Props gradyetc, jazbek.
Fixes #31355.
Built from https://develop.svn.wordpress.org/trunk@34073


git-svn-id: http://core.svn.wordpress.org/trunk@34041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-12 03:37:23 +00:00
Scott Taylor d973339738 After [33891], `get_comment()` returns `global $comment` if no args are passed and the global is set (after setting the default to `null` here). This allows us to ditch global comment imports.
See #33638.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-09 02:51:24 +00:00
Scott Taylor c231add9fe In `wp_list_comments()`, update the comment meta cache when the comments derive from `WP_Query` and the new `->comment_meta_cached` prop is `false`.
There are no uses of `wp_list_comments()` in Core where `$comments` are passed as the 2nd argument.

Adds unit tests.

Props wonderboymusic, bradt.
Fixes #16894.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-05 22:25:24 +00:00
Scott Taylor e73ee5ac98 Introduce `WP_Comment` class to model/strongly-type rows from the comments database table. Inclusion of this class is a pre-req for some more general comment cleanup and sanity.
* Takes inspiration from `WP_Post` and adds sanity to comment caching. 
* Clarifies when the current global value for `$comment` is returned. The current implementation in `get_comment()` introduces side effects and an occasion stale global value for `$comment` when comment caches are cleaned.
* Strongly-types `@param` docs
* This class is marked `final` for now

Props wonderboymusic, nacin.

See #32619.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 18:17:24 +00:00
Scott Taylor ef87172270 `foreach` is a statement, not a function.
See #33491.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:28:22 +00:00
Boone Gorges 8a95b13cab In `WP_Query::parse_tax_query()`, allow 'cat' and 'tag' querystrings to be formatted as arrays.
See [33095] #32454 for a previous fix related to custom taxonomies.

Props Veraxus.
Fixes #33532.
Built from https://develop.svn.wordpress.org/trunk@33724


git-svn-id: http://core.svn.wordpress.org/trunk@33691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-24 21:22:26 +00:00
Scott Taylor d345a6012c `WP_Query`: add changelog for the `title` param after [33706]
Props dimadin.
Fixes #33074.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-24 20:10:26 +00:00
Scott Taylor 523b51a359 Query:
Add a query var, `title`, that allows you to query posts by `post_title`. To accomplish this now, you have to do something like:

{{{
$tacos = get_posts( [
  'post_type' => 'taco',
  's' => $name,
  'exact' => true,
  'sentence' => true,
  'post_status' => 'publish',
  'fields' => 'ids',
  'posts_per_page' => 1
] );
}}}

Adds unit tests.

Fixes #33074.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-22 16:59:26 +00:00
Dominik Schilling 6d45b63562 WordPress 4.3 has just passed 2,222,222 downloads.
(Fix typo in [33653].)
Built from https://develop.svn.wordpress.org/trunk@33661


git-svn-id: http://core.svn.wordpress.org/trunk@33628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 16:00:28 +00:00
Boone Gorges 7c0d3ab83a Introduce `post_name__in` parameter for `WP_Query`.
Props enshrined.
Fixes #33065.
Built from https://develop.svn.wordpress.org/trunk@33653


git-svn-id: http://core.svn.wordpress.org/trunk@33620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 02:19:25 +00:00
Boone Gorges 2096b451c7 In `WP_Query::parse_tax_query()`, allow taxonomy querystring to be formatted as an array.
Props Veraxus.
Fixes #32454.
Built from https://develop.svn.wordpress.org/trunk@33095


git-svn-id: http://core.svn.wordpress.org/trunk@33066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-06 20:37:24 +00:00
Scott Taylor 1ef11d7789 Add missing doc blocks to `query.php`.
Clarify `@return` values where necessary.
Some wrapper functions don't need to return if the function they wrap doesn't return.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-27 18:15:25 +00:00
Dominik Schilling 64fc7294b6 Use HTTPS URLs for codex.wordpress.org.
see #27115.
Built from https://develop.svn.wordpress.org/trunk@32116


git-svn-id: http://core.svn.wordpress.org/trunk@32095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-12 21:29:32 +00:00
Scott Taylor bce851dcf2 Replace `array_shift()` with `reset()` where appropriate for performance.
Props SergeyBiryukov.
Fixes #31259.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-19 03:56:27 +00:00
Boone Gorges 7dcb041d5a More careful type conversion in `WP_Query` `is_*()` methods.
`is_array( 1, '1-foo' )` returns true, which means that `is_page( 1 )`
was returning true when on a page with the slug '1-foo'. We avoid this odd
behavior by casting the queried object ID to a string before testing against
the value passed to the conditional function.

This also helps to avoid a problem where an arbitrary value for `$page` would
cause `is_page( $page )` to return true if the query had been manipulated by
a plugin to show that the current page's ID is 0.

Props boonebgorges, r-a-y, nunomorgadinho, wonderboymusic, clifgriffin.
Fixes #24674.
Built from https://develop.svn.wordpress.org/trunk@31458


git-svn-id: http://core.svn.wordpress.org/trunk@31439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-14 02:09:25 +00:00
Boone Gorges 90639872e8 In `WP_Query::get_queried_object()`, avoid PHP notices when `is_tax` is paired with an empty `tax_query`.
It's possible to have an empty `tax_query` and `is_tax=true` when the initial
query contains a taxonomy var (and is processed as such during
`WP_Query::parse_query()`) but the taxonomy var is unset during a 'parse_query'
callback. While this kind of behavior is not necessarily something we need to
support, we should continue to avoid PHP notices in such cases, as we did prior
to WP 4.1.

Fixes #31246.
Built from https://develop.svn.wordpress.org/trunk@31366


git-svn-id: http://core.svn.wordpress.org/trunk@31347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-07 19:50:24 +00:00
Boone Gorges 7bde88d02e Modify `meta_query orderby syntax to use array keys as clause "handles".
The implementation of `meta_query` orderby introduced in [31312] put clause
identifiers into a 'name' parameter of the clause. For greater clarity, this
changeset updates the syntax to use the associative array key used when
defining `meta_query` parameters, instead of the 'name' parameter.

Props Funkatronic, DrewAPicture.
Fixes #31045.
Built from https://develop.svn.wordpress.org/trunk@31340


git-svn-id: http://core.svn.wordpress.org/trunk@31321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-05 19:38:23 +00:00
Sergey Biryukov 7c97e59ed6 When using WP_Query's `'fields' => 'ids'` (or `'fields' => 'id=>parent'`), make sure the returned result is always an array of integers.
fixes #31194. see #27252.
Built from https://develop.svn.wordpress.org/trunk@31324


git-svn-id: http://core.svn.wordpress.org/trunk@31305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-03 02:29:25 +00:00
Boone Gorges 55dafd966b When querying for a specific post, allow posts with a non-public status to be returned as long as that status is specified.
This makes it possible to, for example, retrieve a specific post using the
`p` parameter of `WP_Query`, even if the post is in the Trash, by including
the `post_status=trash` parameter.

Props ebinnion.
Fixes #29167.
Built from https://develop.svn.wordpress.org/trunk@31321


git-svn-id: http://core.svn.wordpress.org/trunk@31302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-01 20:26:25 +00:00
Boone Gorges ca30c725a0 Improve support for ordering `WP_Query` results by postmeta.
`WP_Meta_Query` clauses now support a 'name' parameter. When building a
`WP_Query` object, the value of 'orderby' can reference this 'name', so that
it's possible to order by any clause in a meta_query, not just the first one
(as when using 'orderby=meta_value'). This improvement also makes it possible
to order by multiple meta query clauses (or by any other eligible field plus
a meta query clause), using the array syntax for 'orderby' introduced in [29027].

Props Funkatronic, boonebgorges.
Fixes #31045.
Built from https://develop.svn.wordpress.org/trunk@31312


git-svn-id: http://core.svn.wordpress.org/trunk@31293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-31 15:48:24 +00:00
Scott Taylor eeda68bbda Fix some erroneous `@param` annotations.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 22:44:25 +00:00
Scott Taylor bc55996a0b `@param` cleanup:
* `get_metadata()` will return literally anything, needs to be `mixed`
* `wp()` and `WP_Query::__construct()` no longer just take a query string
* Clarify a few others

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-16 19:03:23 +00:00
Scott Taylor eed3698c49 In `WP_Query`, only call magic method internals again whitelists of properties and methods, `$compat_fields` and `$compat_methods`. Remove `__unset()` since `__set()` is not implemented.
See #30891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-11 22:41:24 +00:00
Scott Taylor 0a511680f4 Adding a `@return` annotation to constructors is generally not recommended as a constructor does not have a meaningful return value. Constructors do not have meaningful return values, anything that is returned from here is discarded.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:54:23 +00:00
Scott Taylor 60b0cd7943 The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Scott Taylor 80915aaf16 `WP_Query->parse_tax_query()` - for BC, this method is not marked as protected. See [28987]. It needs an access modifier, it shall have `public`. The comment remains.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 05:54:44 +00:00
Scott Taylor 786caa4d55 Correct the `@param` docs for arguments that are truthy/falsey.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 23:04:23 +00:00
Boone Gorges 7e69e5484f In `WP_Query::get_queried_object()`, use the new format for referencing tax query clauses.
`queried_terms`, rather than `queries`, is the tax_query property where a flat
index of terms is stored.

See [29901] for a similar fix in `redirect_canonical()`. See #29738.

Props dd32.
Fixes #30623.
Built from https://develop.svn.wordpress.org/trunk@30771


git-svn-id: http://core.svn.wordpress.org/trunk@30761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 14:58:22 +00:00
Scott Taylor 37a23b2c73 Improve various `@param` docs.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 02:17:21 +00:00
Scott Taylor ba914c7df1 Improve various `@param` docs.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 22:56:25 +00:00
Drew Jaynes fdb0b54389 4.1 Docs Audit: Improve inline documentation for the new `WP_Query::setup_postdata()` method.
See #30469.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 12:18:22 +00:00
Boone Gorges 912cdc5978 Pass query object to 'the_post' filter.
Props tlovett1.
Fixes #30327.
Built from https://develop.svn.wordpress.org/trunk@30323


git-svn-id: http://core.svn.wordpress.org/trunk@30322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-13 02:25:22 +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
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 d7a62c01c4 Improve global variable setting in `setup_postdata()`.
`setup_postdata()` is responsible for setting a number of global variables
that are used for post pagination (`$pages`, `$page`, `$nextpage`) and the
generation of post excerpts (`$more`). These variables should be sensitive to
the currently running instance of `WP_Query` - rather than the main query -
so that these features work properly inside of secondary `WP_Query` loops.

This changeset moves the logic of `setup_postdata()` into a method on `WP_Query`,
and converts `setup_postdata()` to a wrapper.

Props boonebgorges, wonderboymusic.
See #25349.
Fixes #9256, #20904.
Built from https://develop.svn.wordpress.org/trunk@30085


git-svn-id: http://core.svn.wordpress.org/trunk@30085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 02:32:24 +00:00