Commit Graph

555 Commits

Author SHA1 Message Date
Andrew Nacin
77ca1f202a Avoid notice with search feeds.
fixes #25677.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-23 20:55:10 +00:00
Andrew Nacin
6d97f53134 Always apply the posts_search filter. Restores 3.6 behavior.
props SergeyBiryukov.
fixes #25664.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-22 17:21:09 +00:00
Dominik Schilling
e483532553 Move get_current_user_id() call out of if-block, see [25669].
props layotte.
fixes #25372.
Built from https://develop.svn.wordpress.org/trunk@25689


git-svn-id: http://core.svn.wordpress.org/trunk@25605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-03 13:36:09 +00:00
Dominik Schilling
e4c8d56b76 Replace use of global $user_ID in favor of get_current_user_id(). fixes #25372.
Built from https://develop.svn.wordpress.org/trunk@25669


git-svn-id: http://core.svn.wordpress.org/trunk@25585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 21:10:09 +00:00
Andrew Nacin
9e9093ab6d Don't order feeds of search results by relevance.
Allow for orderby=relevance to explicitly request relevance.

fixes #7394.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 21:05:08 +00:00
Scott Taylor
e3d58a5b23 Make url_to_postid() work for custom post type URLs. Use get_post_types() and get_taxonomies() instead of directly accessing globals. Adds unit test.
Props faishal, for the globals fix.
Fixes #19744.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-02 19:42:09 +00:00
Andrew Nacin
d7fc6d5d49 Order search results by relevance, rather than by date.
The ordering logic is as follows:
 * Full sentence matches in post titles.
 * All search terms in post titles.
 * Any search terms in post titles.
 * Full sentence matches in post content.

Each section and any remaining posts are then sorted by date.

Introduces some filters:
 * wp_search_stopwords, to filter stop words ignored in WHERE.
 * posts_search_orderby, to filter the ORDER BY when ordering search results.

props azaozz, wonderboymusic.
fixes #7394.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-27 17:34:09 +00:00
Andrew Nacin
dba857a39a When is_main_query() is called during the pre_get_posts hook, issue _doing_it_wrong().
The is_main_query() WP_Query method should be used in these instances instead.
see #23329.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-24 17:10:09 +00:00
Andrew Nacin
1fda14e76b Introduce a reset_postdata() method on the WP_Query object, which wp_reset_postdata() now wraps.
props ericlewis.
fixes #24785.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-24 15:53:09 +00:00
Scott Taylor
8bd9659d0d Move checks for post_type being an array inline. See [25291], [25292], #18614.
Built from https://develop.svn.wordpress.org/trunk@25312


git-svn-id: http://core.svn.wordpress.org/trunk@25274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 03:02:10 +00:00
Scott Taylor
7af06e7ab3 Add an action at the end of WP_Query::parse_tax_query() called (wait for it...) parse_tax_query which will enable developers to alter $this->tax_query->queries before SQL is generated. pre_get_posts is too early for many scenarios.
Built from https://develop.svn.wordpress.org/trunk@25311


git-svn-id: http://core.svn.wordpress.org/trunk@25273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-10 02:36:09 +00:00
Scott Taylor
a67d551dac Ensure that the post type object is the queried object when a post type has been registered with has_archive => true. Ensure it is not stomped when decorated with tax_query. Adds unit tests.
Props nacin.
Fixes #18614.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 22:07:09 +00:00
Scott Taylor
d7cc1f506a Introduce wp_using_ext_object_cache() - mimic wp_suspend_cache_invalidation() and discourage direct access to $_wp_using_ext_object_cache, cleaning up importing of globals in functions and provides function to modify that global. Loads the packaged object cache when an external cache hasn't been loaded or doesn't contain wp_cache_init().
Fixes #21401.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 18:10:09 +00:00
Scott Taylor
bfdc55b24d Allow is_tag() to accept term_id, slug, 'term_name or array of any. Many other is_*()` funcs already do this. Adds unit tests.
Props ramiy.
Fixes #18746.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 17:27:08 +00:00
Scott Taylor
b22bc5e389 Check bad dates and redirect, instead of 404ing, as necessary and appropriate.
Adds query, conditional, and canonical Unit Tests.

Props kovshenin, SergeyBiryukov, DrewAPicture.
Fixes #10935.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-06 16:36:09 +00:00
Scott Taylor
8038d7f9e8 Move get_meta_type() into the WP_Meta_Query class as get_cast_for_type(). WP_Query can then access it like: $this->meta_query->get_cast_for_type().
See #21621, [25255].


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


git-svn-id: http://core.svn.wordpress.org/trunk@25235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 23:32:09 +00:00
Scott Taylor
4be84bbdfb When meta_type is passed with orderby => meta_value, orderby must also use CAST() to avoid scenarios like: SELECTing by UNSIGNED and then ordering by CHAR. Adds unit test.
Fixes #21621.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-05 16:57:08 +00:00
Scott Taylor
aa480a25e2 Introduce author__in and author__not_in query vars. Fixes issue with multiple author exclusion when comma-separated string is passed for author. Adds a bunch of missing unit tests.
Props pollett for initial patch.
Fixes #16854.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 21:33:09 +00:00
Scott Taylor
4a2c4c8f01 Kill the query in the following edge case: post_type => 'any' but exclude_from_search => false returns no valid post types. Adds unit tests.
Props mitchoyoshitaka.
Fixes #19198.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 18:51:10 +00:00
Scott Taylor
3b1b03e4c4 Convert category__and to category__in (less expensive) and unset it when only one category is passed. Adds unit tests.
Fixes #24245.



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


git-svn-id: http://core.svn.wordpress.org/trunk@25208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-04 18:17:09 +00:00
Andrew Nacin
41f1cd687b WP_Date_Query.
props Viper007Bond.
see #18694.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-27 16:39:09 +00:00
Andrew Nacin
7ff1bbea19 Don't cast the 'm' query variable to an integer as the value can exceed the range of a 32-bit signed integer.
props Viper007Bond.
fixes #24884.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-27 15:20:10 +00:00
Andrew Nacin
9ccc275d88 Correct phpdoc for WP_Query::$post. props lgedeon, fixes #25130.
Built from https://develop.svn.wordpress.org/trunk@25110


git-svn-id: http://core.svn.wordpress.org/trunk@25092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-08-23 22:02:08 +00:00
Andrew Nacin
f106142a9b Avoid getting tripped up on post content that starts with <!--nextpage-->. props SergeyBiryukov. fixes #16746.
git-svn-id: http://core.svn.wordpress.org/trunk@24599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-09 05:23:53 +00:00
Andrew Nacin
092a33115c Remove wp_parse_post_content(), get_paged_content(), paginate_content() from 3.6, and remove the new $id parameters for get_the_content() and the_content().
The content parsing functions are good abstractions, but are no longer needed by core and are too closely tied to legacy globals, rather than paving a new path.

For get_the_content() and the_content(), this only worsens the function prototype. It muddies theme-specific display (more links, etc) with filtered content. `apply_filters( 'the_content', $post->post_content )` is sufficient practice for now.

see #24330, [24301]. see #23625, [23804].



git-svn-id: http://core.svn.wordpress.org/trunk@24598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-09 05:22:50 +00:00
Andrew Nacin
c2db94d10c Use meta caps edit_post, read_post, and delete_post directly, rather than consulting the post type object. map_meta_cap() handles that for us. props markjaquith, kovshenin. fixes #23226.
git-svn-id: http://core.svn.wordpress.org/trunk@24593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-08 20:05:42 +00:00
Mark Jaquith
bf35040898 Squash some PHP notices in taxonomy queries.
props hakre, wonderboymusic. fixes #16465.

git-svn-id: http://core.svn.wordpress.org/trunk@24456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-06-20 17:21:13 +00:00
Ryan Boren
a2b4bc456f * Introduce wp_parse_post_content() and use it in setup_postdata(), get_the_content(), and get_the_remaining_content().
* Add a post ID argument to the_content(), get_the_content(), the_remaining_content(), and get_the_remaining_content().
* Pass the post ID to the the_content filter.
* Remove the format_pages global.
* Declare format_content and split_content as vars in WP_Post.
* phpdoc for the the_content filter that documents the new ID argument and denotes it as not-so-portable.

Props gcorne, DrewAPicture, duck_, aaroncampbell
see #24330


git-svn-id: http://core.svn.wordpress.org/trunk@24301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-20 11:05:50 +00:00
Andrew Nacin
d334db7d4d WP_Query: If the post_type QV is an array with only one element, don't treat it as a multiple post type query.
If there is only one post type used by all taxonomies for a tax query, set the post type to the string.

fixes #24204.



git-svn-id: http://core.svn.wordpress.org/trunk@24115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-27 01:28:35 +00:00
Sergey Biryukov
f37038e6ac Fix typo in phpdoc. props jcastaneda. fixes #24185.
git-svn-id: http://core.svn.wordpress.org/trunk@24096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-25 23:10:36 +00:00
Mark Jaquith
2d382c1a5c Post Formats: use the content body for the body of the Quote post format.
* Searchable, better editing tools
* Less cluttered Post Format UI

props kovshenin, DrewAPicture. see #24009

git-svn-id: http://core.svn.wordpress.org/trunk@24034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-18 18:07:58 +00:00
Mark Jaquith
697bf3d70e Only remove ONE piece of media from the content in setup_postdata().
props wonderboymusic. fixes #24052.

git-svn-id: http://core.svn.wordpress.org/trunk@23984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-14 01:11:44 +00:00
Mark Jaquith
15dc5a3718 Standardize the post format theme API functions with the_post_format_THING() and get_the_post_format_THING().
fixes #23927

git-svn-id: http://core.svn.wordpress.org/trunk@23899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-04 08:09:02 +00:00
Mark Jaquith
6d085d83d5 Chat post format code cleanup.
see #23625. props obenland.

git-svn-id: http://core.svn.wordpress.org/trunk@23876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-29 21:06:37 +00:00
Mark Jaquith
1b83157127 Give themers tangible, user-friendly template functions to take full advantage of structured post formats.
* the_audio()
* the_video()
* the_image()
* get_the_media()

Also introduces:

* get_the_extra_content()
* the_extra_content()

Those two functions are like their non-extra versions, except that they
will have any post-format bits extracted. e.g. It's an image post, for
which the_image() will extract an <img /> tag. the_extra_content() will
output the content *without* that image.

props wonderboymusic. Herculean effort. fixes #23572

git-svn-id: http://core.svn.wordpress.org/trunk@23819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-27 18:34:59 +00:00
Mark Jaquith
e11cb17f77 Extract chats as structured data.
* add_chat_detection_format() — to add a chat regex pattern
* get_content_chat() — to grab a chat from content
* get_the_chat() — grab the chat from the current (or passed) post
* the_chat() — output the chat in formatted HTML
* paginate_content() — puts the <!--nextpage--> splitting stuff into a function
* get_paged_content() — grabs a page of raw content, needed to paginate chats properly

see #23625. props wonderboymusic, lancewillett.

git-svn-id: http://core.svn.wordpress.org/trunk@23804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-27 08:31:12 +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
Andrew Nacin
34e93a1155 WP_Query: post_parent__in and post_parent__not_in. props wonderboymusic. fixes #11056.
git-svn-id: http://core.svn.wordpress.org/trunk@23436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-16 02:08:46 +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
Helen Hou-Sandí
b1f1579604 its <=> it's in documentation, along with a rogue the, The, and looses. props trepmal. fixes #22665.
git-svn-id: http://core.svn.wordpress.org/trunk@23191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-20 15:55:32 +00:00
Andrew Nacin
fa10ccba23 Account for taxonomies tied to specific kinds of attachments when setting up post types for a taxonomy query.
props jondavidjohn. see #21290.



git-svn-id: http://core.svn.wordpress.org/trunk@22718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 17:33:21 +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
Ryan Boren
7cc32c3990 If $this->posts is empty, don't do stuff to it.
Props wonderboymusic
fixes #22061


git-svn-id: http://core.svn.wordpress.org/trunk@22465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-08 13:52:40 +00:00
Andrew Nacin
f85592021d Don't call get_term_by() in get_queried_object() if we have no terms. props wonderboymusic. fixes #21967.
git-svn-id: http://core.svn.wordpress.org/trunk@22450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 22:09:05 +00:00
Ryan Boren
33fe750dce Don't assign wp_the_query to wp_query by reference. Removing the ref avoids accidentally stomping wp_the_query.
Props scribu, wpmuguru
fixes #22125


git-svn-id: http://core.svn.wordpress.org/trunk@22434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 20:03:28 +00:00
Andrew Nacin
3a86c87c31 Remove single-argument calls to wpdb:prepare(), which are invalid as nothing is being prepared. see #22262.
git-svn-id: http://core.svn.wordpress.org/trunk@22428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 19:28:08 +00:00
Ryan Boren
9e39bc5897 If posts is an empty array, bail from set_found_posts(). If posts is null or otherwise empty proceed through set_found_posts(). This accommodates caching plugins such as Advanced Post Cache that force posts to be empty for later population but still require the found_posts_query filter to run.
fixes #14426


git-svn-id: http://core.svn.wordpress.org/trunk@22258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-17 20:57:23 +00:00
Ryan Boren
2c0d4f8ebf Pass the result of the the_preview filter through get_post() to ensure the post is filtered and of type WP_Post. fixes #22162
git-svn-id: http://core.svn.wordpress.org/trunk@22244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-16 13:48:07 +00:00
Ryan Boren
7bf8c86dac Replace the sanitize loop at the end of WP_Query::get_posts() with an array_map of get_post(). get_post() will ensure each object in the loop is sanitized and is of the type WP_Post. see #22162
git-svn-id: http://core.svn.wordpress.org/trunk@22238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-15 20:42:57 +00:00
Ryan Boren
09806c6b5f Convert the object in the posts array to WP_Post only if the posts array is not empty. Some post caching plugins can cause it to be empty. see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@22011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-26 12:32:54 +00:00
Ryan Boren
2b044bc85f * Avoid FOUND ROWS when no posts are found
* Set post_count and found_posts for all 'fields' queries.
* Set found_posts to post_count when limits are not used
* Update phpdoc for $found_posts and set_found_posts()

Props SergeyBiryukov, wonderboymusic

fixes #14426



git-svn-id: http://core.svn.wordpress.org/trunk@21928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-20 14:55:54 +00:00
Andrew Nacin
095bc8b482 Clarify that conditional tags only return true for existing objects, not 404 situations. props SergeyBiryukov, fixes #16312.
git-svn-id: http://core.svn.wordpress.org/trunk@21890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-18 17:35:11 +00:00
Andrew Nacin
2a4fc8952f Split tag names by [\r\n\t ] rather than \s to avoid that character class from eating characters. props rstern, SergeyBiryukov. fixes #21779. see #13413.
git-svn-id: http://core.svn.wordpress.org/trunk@21862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-15 20:13:44 +00:00
Andrew Nacin
9ae3bf6fa6 When doing a taxonomy query, search against the currently registered post types of the queried taxonomies.
Prevents posts of a type no longer assigned to a queried taxonomy from being returned.

props jondavidjohn. fixes #21290.



git-svn-id: http://core.svn.wordpress.org/trunk@21855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-15 19:44:51 +00:00
Andrew Nacin
a42be1dbb3 Check that the taxonomy matches when calling is_tax() with only a taxonomy argument. props wonderboymusic, see #20590.
git-svn-id: http://core.svn.wordpress.org/trunk@21836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-13 17:15:13 +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
Mark Jaquith
de36de7a8e Allow orderby=post__in, which uses the explicit order you provided in the post__in parameter. fixes #13729. props jakemgold, Otto42.
git-svn-id: http://core.svn.wordpress.org/trunk@21776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-06 19:01:21 +00:00
Andrew Ozz
a9dc9dc829 Add menu_order to fill_query_vars(), see #21618
git-svn-id: http://core.svn.wordpress.org/trunk@21756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-04 23:18:14 +00:00
Ryan Boren
dc8bbc5a59 Allow querying by menu_order. Props wonderboymusic. fixes #21618
git-svn-id: http://core.svn.wordpress.org/trunk@21748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-04 21:09:27 +00:00
Ryan Boren
18a1783423 Update phpdoc for functions that return WP_Post. Soft deprecate get_page(). see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-23 20:34:41 +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
7515511dd9 Use get_posts() to fetch stickies rather than custom bare SQL. Props scribu. see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-22 18:24:23 +00:00
Andrew Nacin
d65b2caac9 Ensure sticky posts are WP_Post objects. props mdawaffe. see #21309.
git-svn-id: http://core.svn.wordpress.org/trunk@21569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-21 04:04:54 +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
nacin
cc06e13817 Use is_main_query() method, rather than the function. Only decode the search query variable if we are executing the main query and it came from the /search/ base, rather than the query string. fixes #13961.
git-svn-id: http://core.svn.wordpress.org/trunk@21248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-09 17:28:55 +00:00
markjaquith
8baa55f667 urldecode() search strings that come in from /search/foo. props SergeyBiryukov. fixes #13961
git-svn-id: http://core.svn.wordpress.org/trunk@21187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-30 07:47:22 +00:00
ryan
8142f2eb36 Pass a post object instead of ID to help preserve ancestors. Props duck_. fixes #18536
git-svn-id: http://core.svn.wordpress.org/trunk@21073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-12 23:09:27 +00:00
ryan
2fa8066123 Disambiguate menu_order. Props markjaquith. fixes #20711
git-svn-id: http://core.svn.wordpress.org/trunk@20836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-21 19:50:58 +00:00
ryan
97aff78b06 Set split_the_query to false if more than 500 rows requested. Props SergeyBiryukov. fixes #20628
git-svn-id: http://core.svn.wordpress.org/trunk@20756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-09 17:20:22 +00:00
ryan
bfe82654d6 Don't split the main query if there is no limit. This helps avoid extremely long query strings that could cause segfaults. Allow plugins to control splitting via split_the_query filter. see #20628
git-svn-id: http://core.svn.wordpress.org/trunk@20740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-08 20:01:47 +00:00
nacin
256747055b No need for by-reference when calculating the queried object in PHP5. props SergeyBiryukov, duck_, fixes #20039.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-17 03:41:07 +00:00
nacin
c0a461e6fe Always pass a table alias to wp_post_mime_type_where(). Prevents ambiguous queries when adding joins later on. props benbalter, fixes #20193.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-30 13:08:12 +00:00
ryan
6241238938 Call _get_post_ancestors() from get_post_ancestors() if the ancestors property is not set in the post object. Works around situations where ancestors is not set in the cached version of the post object. see #18536
git-svn-id: http://svn.automattic.com/wordpress/trunk@20171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-12 18:23:48 +00:00
ryan
207ca8ce44 Return to apply_filters_ref_array() for back compat with callbacks that specify a ref for the args. Props scribu. see #18536
git-svn-id: http://svn.automattic.com/wordpress/trunk@20024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-28 20:37:47 +00:00
nacin
72791ea930 Use is_admin WP_Query propery, not is_admin(), when adding protected post statuses to the query. Allows for overriding on the parse_query hook. fixes #20049.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-15 19:58:10 +00:00
ryan
6aedd9d0f0 Split the main WP_Query posts query into two queries to avoid temp tables. Leverage cache to avoid second query in persistent cache environments. Props scribu, cheald, prettyboymp. see #18536
git-svn-id: http://svn.automattic.com/wordpress/trunk@19918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-14 15:09:35 +00:00
nacin
d3cd671bce Use [\r\n\t ], not [\s], to prevent issues with some UTF-8 characters. props SergeyBiryukov, fixes #19033.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-08 15:35:22 +00:00
ryan
8c3ec18a21 Code cleanup in the paging block. Props kawauso. fixes #19773
git-svn-id: http://svn.automattic.com/wordpress/trunk@19724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-09 20:08:57 +00:00
ryan
e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
ryan
83b131f8e3 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: http://svn.automattic.com/wordpress/trunk@19687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 20:50:54 +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
nacin
3dc9933800 Fix notice when viewing a post preview logged out. props SergeyBiryukov, fixes #19366.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-20 20:46:06 +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
dd32
c85525aece Switch to sanitize_title_for_query() for Query sanitization (allows for pre-3.3 page slugs to be viewable), Don't update page slugs to new slug-types when the slug is not being changed, Don't issue a XHR if the page slug hasn't changed. Group effort props xknown, markjaquith, nacin. See #19292
git-svn-id: http://svn.automattic.com/wordpress/trunk@19444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-24 00:20:21 +00:00
nacin
964b620f7b Remove unused variable. props kawauso, see #18364.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-08 17:53:52 +00:00
ryan
94dfc448b0 Compute in_search_post_types only when needed. Props mitchoyoshitaka. fixes #18364
git-svn-id: http://svn.automattic.com/wordpress/trunk@19078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-28 20:03:26 +00:00
nacin
89c0895887 new does not require by reference.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-18 20:20:59 +00:00
ryan
d7a17b96e9 Avoid refetching a post in get_post() when passed a post object that has already been raw sanitized. Clean up sanitize loop. Props scribu. fixes #18822
git-svn-id: http://svn.automattic.com/wordpress/trunk@18846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 19:06:18 +00:00
ryan
559085db40 Add name to list of allowed keys. Props MarcusPope. fixes #18638
git-svn-id: http://svn.automattic.com/wordpress/trunk@18838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 16:43:57 +00:00
nacin
b3dfd9e953 is_main_query(). fixes #18677.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-17 20:46:35 +00:00
duck_
2f51b9be0d Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-05 19:08:15 +00:00
ryan
af6f9de61b Don't attempt old slug redirect for multi-post_type queries. Props aaroncampbell. see #16949
git-svn-id: http://svn.automattic.com/wordpress/trunk@18330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-23 16:35:34 +00:00
nacin
2571545ec0 @since s/3.2/3.2.0/
git-svn-id: http://svn.automattic.com/wordpress/trunk@18268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-11 04:40:18 +00:00
ryan
a7d3ff7df0 Remove duplicate sentence search terms. Props scribu. fixes #17152
git-svn-id: http://svn.automattic.com/wordpress/trunk@18056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-26 16:41:59 +00:00
nacin
70a4181fc7 Cache post thumbnails in the loop. props garyc40, scribu, greuben. fixes #15447.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-12 03:06:03 +00:00
nacin
1379f7a976 Use int for redirect code. props niallkennedy, fixes #17321.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-05 17:33:19 +00:00
ryan
04487fc268 Constructor cleanup. Props ocean90. fixes #16768
git-svn-id: http://svn.automattic.com/wordpress/trunk@17771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-29 20:05:12 +00:00
ryan
0667ceb3be Introduce WP_Meta_Query and relation support. Props scribu, greuben. fixes #17165 #17011
git-svn-id: http://svn.automattic.com/wordpress/trunk@17699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-25 17:27:35 +00:00
dd32
1eaf6f8527 Allow WP_Query 'post_status' parameter to accept an array, as well as a singular value and comma separated list. Fixes #16824
git-svn-id: http://svn.automattic.com/wordpress/trunk@17689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-23 10:36:22 +00:00
ryan
2053dcca12 Don't pollute orderby query var. Props scribu. fixes #16844
git-svn-id: http://svn.automattic.com/wordpress/trunk@17653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-18 21:27:13 +00:00