Commit Graph

456 Commits

Author SHA1 Message Date
Ryan Boren 4c29375d2c 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: https://develop.svn.wordpress.org/trunk@22011 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-26 12:32:54 +00:00
Ryan Boren 42ca24f54e * 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: https://develop.svn.wordpress.org/trunk@21928 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-20 14:55:54 +00:00
Andrew Nacin fc58815067 Clarify that conditional tags only return true for existing objects, not 404 situations. props SergeyBiryukov, fixes #16312.
git-svn-id: https://develop.svn.wordpress.org/trunk@21890 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-18 17:35:11 +00:00
Andrew Nacin 9b8123711c 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: https://develop.svn.wordpress.org/trunk@21862 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-15 20:13:44 +00:00
Andrew Nacin 322919eb1c 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: https://develop.svn.wordpress.org/trunk@21855 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-15 19:44:51 +00:00
Andrew Nacin 80e56f5a88 Check that the taxonomy matches when calling is_tax() with only a taxonomy argument. props wonderboymusic, see #20590.
git-svn-id: https://develop.svn.wordpress.org/trunk@21836 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-13 17:15:13 +00:00
Ryan Boren 879cb8231b Remove unnecessary return by refs. Props wonderboymusic. fixes #21839
git-svn-id: https://develop.svn.wordpress.org/trunk@21792 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-10 17:00:11 +00:00
Mark Jaquith c5c65130c9 Allow orderby=post__in, which uses the explicit order you provided in the post__in parameter. fixes #13729. props jakemgold, Otto42.
git-svn-id: https://develop.svn.wordpress.org/trunk@21776 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-06 19:01:21 +00:00
Andrew Ozz 1e7a5ed329 Add menu_order to fill_query_vars(), see #21618
git-svn-id: https://develop.svn.wordpress.org/trunk@21756 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-04 23:18:14 +00:00
Ryan Boren ca00a01d11 Allow querying by menu_order. Props wonderboymusic. fixes #21618
git-svn-id: https://develop.svn.wordpress.org/trunk@21748 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-04 21:09:27 +00:00
Ryan Boren 9905abe697 Update phpdoc for functions that return WP_Post. Soft deprecate get_page(). see #21309
git-svn-id: https://develop.svn.wordpress.org/trunk@21598 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-23 20:34:41 +00:00
Ryan Boren de06b81360 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: https://develop.svn.wordpress.org/trunk@21597 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-23 20:01:10 +00:00
Ryan Boren 62b6207685 Use get_posts() to fetch stickies rather than custom bare SQL. Props scribu. see #21309
git-svn-id: https://develop.svn.wordpress.org/trunk@21585 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-22 18:24:23 +00:00
Andrew Nacin 29cfcf3b63 Ensure sticky posts are WP_Post objects. props mdawaffe. see #21309.
git-svn-id: https://develop.svn.wordpress.org/trunk@21569 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-21 04:04:54 +00:00
Ryan Boren 30218d5ea5 Introduce WP_Post class. Clean up ancestors handling. Props scribu, toppa. fixes #10381 see #21309
git-svn-id: https://develop.svn.wordpress.org/trunk@21559 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-20 19:47:52 +00:00
Andrew Nacin 9f9f2bcf13 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: https://develop.svn.wordpress.org/trunk@21248 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-09 17:28:55 +00:00
Mark Jaquith 0b294b9481 urldecode() search strings that come in from /search/foo. props SergeyBiryukov. fixes #13961
git-svn-id: https://develop.svn.wordpress.org/trunk@21187 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-30 07:47:22 +00:00
Ryan Boren a0a36d35c9 Pass a post object instead of ID to help preserve ancestors. Props duck_. fixes #18536
git-svn-id: https://develop.svn.wordpress.org/trunk@21073 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-12 23:09:27 +00:00
Ryan Boren c392250983 Disambiguate menu_order. Props markjaquith. fixes #20711
git-svn-id: https://develop.svn.wordpress.org/trunk@20836 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-21 19:50:58 +00:00
Ryan Boren 3c00653719 Set split_the_query to false if more than 500 rows requested. Props SergeyBiryukov. fixes #20628
git-svn-id: https://develop.svn.wordpress.org/trunk@20756 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-09 17:20:22 +00:00
Ryan Boren 6f90e8abd6 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: https://develop.svn.wordpress.org/trunk@20740 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-08 20:01:47 +00:00
Andrew Nacin 6588a3fa0c No need for by-reference when calculating the queried object in PHP5. props SergeyBiryukov, duck_, fixes #20039.
git-svn-id: https://develop.svn.wordpress.org/trunk@20491 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-17 03:41:07 +00:00
Andrew Nacin 0fe62673e5 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: https://develop.svn.wordpress.org/trunk@20325 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-30 13:08:12 +00:00
Ryan Boren 1a41092158 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: https://develop.svn.wordpress.org/trunk@20171 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-12 18:23:48 +00:00
Ryan Boren e6411302f0 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: https://develop.svn.wordpress.org/trunk@20024 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-28 20:37:47 +00:00
Andrew Nacin e413239e0a 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: https://develop.svn.wordpress.org/trunk@19932 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-15 19:58:10 +00:00
Ryan Boren 021c55798e 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: https://develop.svn.wordpress.org/trunk@19918 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-14 15:09:35 +00:00
Andrew Nacin be343dba2c Use [\r\n\t ], not [\s], to prevent issues with some UTF-8 characters. props SergeyBiryukov, fixes #19033.
git-svn-id: https://develop.svn.wordpress.org/trunk@19866 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-08 15:35:22 +00:00
Ryan Boren dc3bccda20 Code cleanup in the paging block. Props kawauso. fixes #19773
git-svn-id: https://develop.svn.wordpress.org/trunk@19724 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-09 20:08:57 +00:00
Ryan Boren 2b186b0c45 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: https://develop.svn.wordpress.org/trunk@19712 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-08 17:01:11 +00:00
Ryan Boren a8d77cbae9 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: https://develop.svn.wordpress.org/trunk@19687 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:50:54 +00:00
Ryan Boren 5e76729992 One newline is enough.
git-svn-id: https://develop.svn.wordpress.org/trunk@19684 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:10:39 +00:00
Andrew Nacin 24a1c0ab4a Fix notice when viewing a post preview logged out. props SergeyBiryukov, fixes #19366.
git-svn-id: https://develop.svn.wordpress.org/trunk@19604 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-20 20:46:06 +00:00
Ryan Boren 676ba7043e Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: https://develop.svn.wordpress.org/trunk@19593 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-13 23:45:31 +00:00
Dion Hulse d70ddc49f9 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: https://develop.svn.wordpress.org/trunk@19444 602fd350-edb4-49c9-b593-d223f7449a82
2011-11-24 00:20:21 +00:00
Andrew Nacin 3db76467e8 Remove unused variable. props kawauso, see #18364.
git-svn-id: https://develop.svn.wordpress.org/trunk@19216 602fd350-edb4-49c9-b593-d223f7449a82
2011-11-08 17:53:52 +00:00
Ryan Boren 2e089de79f Compute in_search_post_types only when needed. Props mitchoyoshitaka. fixes #18364
git-svn-id: https://develop.svn.wordpress.org/trunk@19078 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-28 20:03:26 +00:00
Andrew Nacin 90f95e0204 new does not require by reference.
git-svn-id: https://develop.svn.wordpress.org/trunk@18995 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-18 20:20:59 +00:00
Ryan Boren c3212d522e 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: https://develop.svn.wordpress.org/trunk@18846 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-30 19:06:18 +00:00
Ryan Boren cff31ae5f5 Add name to list of allowed keys. Props MarcusPope. fixes #18638
git-svn-id: https://develop.svn.wordpress.org/trunk@18838 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-30 16:43:57 +00:00
Andrew Nacin 68c1b54796 is_main_query(). fixes #18677.
git-svn-id: https://develop.svn.wordpress.org/trunk@18699 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-17 20:46:35 +00:00
Jon Cave 82c0f09c09 Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: https://develop.svn.wordpress.org/trunk@18639 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-05 19:08:15 +00:00
Ryan Boren bb75e13b17 Don't attempt old slug redirect for multi-post_type queries. Props aaroncampbell. see #16949
git-svn-id: https://develop.svn.wordpress.org/trunk@18330 602fd350-edb4-49c9-b593-d223f7449a82
2011-06-23 16:35:34 +00:00
Andrew Nacin a657a1986c @since s/3.2/3.2.0/
git-svn-id: https://develop.svn.wordpress.org/trunk@18268 602fd350-edb4-49c9-b593-d223f7449a82
2011-06-11 04:40:18 +00:00
Ryan Boren 9294a6cb6d Remove duplicate sentence search terms. Props scribu. fixes #17152
git-svn-id: https://develop.svn.wordpress.org/trunk@18056 602fd350-edb4-49c9-b593-d223f7449a82
2011-05-26 16:41:59 +00:00
Andrew Nacin a270cd105c Cache post thumbnails in the loop. props garyc40, scribu, greuben. fixes #15447.
git-svn-id: https://develop.svn.wordpress.org/trunk@17883 602fd350-edb4-49c9-b593-d223f7449a82
2011-05-12 03:06:03 +00:00
Andrew Nacin d36556bca2 Use int for redirect code. props niallkennedy, fixes #17321.
git-svn-id: https://develop.svn.wordpress.org/trunk@17810 602fd350-edb4-49c9-b593-d223f7449a82
2011-05-05 17:33:19 +00:00
Ryan Boren 9730cb8d15 Constructor cleanup. Props ocean90. fixes #16768
git-svn-id: https://develop.svn.wordpress.org/trunk@17771 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-29 20:05:12 +00:00
Ryan Boren 96fe89727e Introduce WP_Meta_Query and relation support. Props scribu, greuben. fixes #17165 #17011
git-svn-id: https://develop.svn.wordpress.org/trunk@17699 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-25 17:27:35 +00:00
Dion Hulse 5292937f16 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: https://develop.svn.wordpress.org/trunk@17689 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-23 10:36:22 +00:00