Commit Graph

677 Commits

Author SHA1 Message Date
Drew Jaynes
0469b382a3 Inline documentation for various SQL clause hooks in wp-includes/query.php.
Covers documentation for SQL clause hooks related to comment feeds, including:
* `comment_feed_join`
* `comment_feed_where`
* `comment_feed_groupby`
* `comment_feed_orderby`
* `comment_feed_limits`

Props dougwollison, DrewAPicture.
See #25514.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-20 17:46:13 +00:00
Drew Jaynes
6060a66451 Inline documentation for various SQL clause hooks in wp-includes/query.php.
Covers documentation for SQL clause hooks specified for use by caching plugins, including:
* `posts_selection`
* `posts_where_request`
* `posts_groupby_request`
* `posts_join_request`
* `posts_orderby_request`
* `posts_distinct_request`
* `posts_fields_request`
* `post_limits_request`
* `posts_clauses_request`

Props dougwollison, DrewAPicture.
See #25514.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-20 17:41:12 +00:00
Drew Jaynes
742c77fc6f Inline documentation for various SQL clause hooks in wp-includes/query.php.
Covers documentation for general SQL clause hooks, including:
* `posts_where`
* `posts_join`
* `posts_where_paged`
* `posts_groupby`
* `posts_join_paged`
* `posts_orderby`
* `posts_distinct`
* `post_limits`
* `posts_fields`
* `posts_clauses`

Props dougwollison, DrewAPicture.
See #25514.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-20 17:34:14 +00:00
Scott Taylor
d6baca3c35 Fix an error in SQL generation when perm is set and an array is passed for post_status. Adds unit test.
Props oso96_2000.
Fixes #25523.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-02 07:36:13 +00:00
Scott Taylor
d8db2e0cc7 Fix imperceptible whitespace cruff from [27017].
Built from https://develop.svn.wordpress.org/trunk@27018


git-svn-id: http://core.svn.wordpress.org/trunk@26895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-22 22:35:12 +00:00
Scott Taylor
580d8ab0db Fix a bit of whitespace from [27016].
Built from https://develop.svn.wordpress.org/trunk@27017


git-svn-id: http://core.svn.wordpress.org/trunk@26894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-22 22:34:12 +00:00
Scott Taylor
a9c661c00e Let is_attachment() accept an $attachment parameter, similar to is_page() and is_single(). Adds Unit Tests for all 3.
Props alex-ye for the initial patch.
Fixes #24257.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-22 22:31:12 +00:00
Sergey Biryukov
9572d2d001 Avoid a fatal error in wp_reset_postdata() if $wp_query global is not set.
see #26775 for trunk.
Built from https://develop.svn.wordpress.org/trunk@26932


git-svn-id: http://core.svn.wordpress.org/trunk@26813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-11 23:57:14 +00:00
Scott Taylor
f3b433cec3 In WP_Query::get_queried_object(), move the check for $query['terms'] to a place where $query is actually set. This should be included if [26864] makes it into 3.8.1.
Props SergeyBiryukov.
See #26728, [26864], #26634, #26627.



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


git-svn-id: http://core.svn.wordpress.org/trunk@26758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-27 19:30:10 +00:00
Scott Taylor
014007f029 Fix a regression for get_queried_object() by checking for category_name when cat isn't set - mainly is_category() being true for Uncategorized or when queried object is accessed in pre_get_posts. Also check for $query['terms'] when trying to assign a term as the queried object when is_tax() is true. Adds a unit test. See [26007] for how I originally broke this while fixing a bigger issue.
Props Chouby, jeremyfelt.
Fixes #26634, #26627.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-22 18:31:12 +00:00
Andrew Nacin
ba55e433a4 Revert [26012] for now, which had fixed using paged with offset in WP_Query but introduced side effects for those working around it.
see #18897.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-02 16:26:10 +00:00
Scott Taylor
45deda0726 Fix canonical redirection of cat as described in #15256 by rolling the cat query var into tax_query, instead of category__in / category__not_in. Top-level categories were only redirecting properly if they had no children.
All unit tests pass. Tests marked for #15256 are no longer skipped.

Fixes #15256.
Props dd32.


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


git-svn-id: http://core.svn.wordpress.org/trunk@26008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-11 18:36:10 +00:00
Sergey Biryukov
8d659b278c Fix docblock formatting. fixes #25893.
Built from https://develop.svn.wordpress.org/trunk@26081


git-svn-id: http://core.svn.wordpress.org/trunk@26001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-11 13:32:10 +00:00
Sergey Biryukov
47151b3534 Add @return for WP_Query::parse_search(). props tivnet. fixes #25894.
Built from https://develop.svn.wordpress.org/trunk@26061


git-svn-id: http://core.svn.wordpress.org/trunk@25984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 16:05:10 +00:00
Sergey Biryukov
297e714932 Declare the variable before using it. props tivnet. fixes #25895 for trunk.
Built from https://develop.svn.wordpress.org/trunk@26060


git-svn-id: http://core.svn.wordpress.org/trunk@25983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-09 15:53:09 +00:00
Scott Taylor
a519007202 Respect paged when offset is used in WP_Query. Adds unit tests.
Props coffee2code.
Fixes #18897.


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


git-svn-id: http://core.svn.wordpress.org/trunk@25943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-05 01:35:10 +00:00
Scott Taylor
ca85591c3c Category and tag are typically checked before checking for a custom taxonomy. If the global query matches category or tag (even if it also has tax_query set), return category/tag as the queried object, instead of arbitrarily returning the first term in the tax_query stack (typically those added with 'pre_get_posts').
Real world example: http://www.emusic.com/17dots/topics/daily-download/ - "tag" page, regionalized for US-only content using `pre_get_posts` passing in the terms "US" and "ALL" for "region" (custom tax). All of the theme functions would output "ALL" as the term name. Even though it was a tag archive, the queried object was an arbitrary term from `tax_query`.

See [26006]. All unit tests pass.
Fixes #20767.



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


git-svn-id: http://core.svn.wordpress.org/trunk@25938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-04 23:54:10 +00:00
Andrew Nacin
3b82280cb4 Query stopwords: Only eliminate single A-Z letters as search terms.
Stop trying to match any single letters that are not East Asian characters, as this requires PCRE with UTF-8 support; and because it doesn't actually work.

fixes #25709.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-27 20:51:10 +00:00
Andrew Nacin
c08aee70bb In search stopwords filtering, suppress possible PHP warnings when PCRE lacks UTF-8 support.
see #25709.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-26 05:59:09 +00:00
Andrew Nacin
70fd806759 Revert r25824:25875 from the core.svn.wordpress.org repository.
These commits were accidentally re-synced commits from develop.svn.wordpress.org due to a race condition. Thankfully, the history of this repository matters fairly little. It also happened only for trunk.


git-svn-id: http://core.svn.wordpress.org/trunk@25876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-25 02:29:52 +00:00
Andrew Nacin
93e54b6646 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@25867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:59:12 +00:00
Andrew Nacin
8ae8e01b67 Remove the old wp_auto_updates_maybe_update cron event. Schedule the new wp_maybe_auto_update event at 7 a.m. and 7 p.m. in the site's timezone.
see #27704.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-24 22:53:14 +00:00
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
ryan
f67a8e70ed There is not a NOT operator. Props scribu. fixes #17054 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-06 16:08:23 +00:00
ryan
ebaa6ded07 Set is_* flags for AND taxonomy queries. fixes #17054 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-05 18:48:53 +00:00
ryan
1853efd70a Parse the meta query again if query vars change. Set a global query_vars_changed flag instead of doing multiple hash creation calls. Props greuben. see #16742 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-24 16:07:24 +00:00
ryan
26bdf10db9 Add back compat fields to queried category objects. Props scribu, duck_. fixes #16857 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-22 20:27:45 +00:00
ryan
ebecb8ffdf Return false instead of WP_Error from get_term_by() if the term does not exist. Makes fetching a term by id consistent with slug and name. Props hakre. fixes #16464 #16717 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-22 20:06:38 +00:00
ryan
183cd06cf3 Check for WP_Error return from get_term_by(). Props fabifott, kawauso, nacin. fixes #16717 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-08 22:06:35 +00:00
ryan
73799784cc Don't perform taxonomy queries for single post requests. Props scribu. fixes #16793 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-08 22:01:19 +00:00
ryan
9e37c6dc0a Don't double process the tag query var. Props scribu. fixes #16730 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-03 16:11:02 +00:00
markjaquith
8c218d87f0 Reparse the taxonomy query if query vars change. fixes #16622 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-02 04:10:21 +00:00
ryan
a2603e710e Use ->query instead of . Always kick off the parse_query action. fixes #16545 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-02-16 16:25:52 +00:00
ryan
c6931fd951 Run parse_query() in get_posts() so that the query vars are always parsed for set(), get_posts() patterns. fixes #16545 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-02-15 23:57:13 +00:00
ryan
f63ccddadb Pink the whites.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-02-09 17:35:36 +00:00
markjaquith
8e98240a80 Get is_post_type_archive( 'my-post-type' ) working properly outside of the loop. props bit4. fixes #16347
git-svn-id: http://svn.automattic.com/wordpress/trunk@17358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-01-24 21:15:50 +00:00
ryan
121c9615e1 Resurrect 'tag' query processing. see #16157
git-svn-id: http://svn.automattic.com/wordpress/trunk@17272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-01-12 21:44:47 +00:00
ryan
1e7b49cece Set tag_id for tag queries. Add NOT support to wp_list_filter(). Props scribu. fixes #16170
git-svn-id: http://svn.automattic.com/wordpress/trunk@17251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-01-11 18:56:59 +00:00
ryan
939d6de748 Don't parse cat query var twice. Don't include children for category__* queries. Props SergeyBiryukov. see #16152
git-svn-id: http://svn.automattic.com/wordpress/trunk@17246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-01-09 20:49:11 +00:00
ryan
6a812fc677 Cast category and tag query args to array to allow passing a single ID or slug. Props SergeyBiryukov. fixes #14892
git-svn-id: http://svn.automattic.com/wordpress/trunk@17245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-01-09 16:42:01 +00:00
ryan
f06af8506b category__and, tag__and, tag_slug__in, tag_slug__and support. fixes #16157
git-svn-id: http://svn.automattic.com/wordpress/trunk@17244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-01-09 16:19:48 +00:00
ryan
6baed7c3ea Use correct var. Props westi. fixes #16145
git-svn-id: http://svn.automattic.com/wordpress/trunk@17243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-01-08 17:21:49 +00:00
nacin
f508173dc0 get_meta_sql should be private. see #14645.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-29 19:31:35 +00:00
ryan
b18df57937 Ignore an empty pagename when correcting is_* for page_on_front requests. Props donalmacarthur, SergeyBiryukov, filosofo. fixes #16002
git-svn-id: http://svn.automattic.com/wordpress/trunk@17162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-28 22:34:15 +00:00
dd32
9f6d86636a Set taxonomy/term back-compat query vars for all views (not just taxonomy indexes). Fixes #15978
git-svn-id: http://svn.automattic.com/wordpress/trunk@17147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-25 23:26:09 +00:00
nacin
1a5d8ccdd8 Clarify the _doing_it_wrong message for conditioanl tags. init prevents the fatal error, but the query still isn't run. Just drop the mention of a hook and we end up with better reasoning why this doesn't work to boot. see #14729.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-20 16:21:42 +00:00
nacin
d6c6444ae8 Don't fatal error when conditional tags are called before init. fixes #14729.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-19 21:17:52 +00:00
ryan
7e25e3b363 Add like_escape() to some queries. fixes #15764
git-svn-id: http://svn.automattic.com/wordpress/trunk@16999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-16 14:22:41 +00:00
nacin
d151bf4d8a You are doing it wrong in query.php. see #15824, see #14729.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-15 12:21:27 +00:00
scribu
6114b7403c Always set groupby when a tax query is involved. See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-13 15:15:58 +00:00
scribu
0aaef4b1ad Always call WP_Tax_Query::get_sql(). Fixes #15797
git-svn-id: http://svn.automattic.com/wordpress/trunk@16893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-13 15:11:02 +00:00
scribu
91812fa4a7 Set $wp_query->tax_query earlier. See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-12 16:38:51 +00:00
scribu
cd02eb7f3f Don't set query flags in parse_tax_query(). See #15487
git-svn-id: http://svn.automattic.com/wordpress/trunk@16880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-11 15:20:52 +00:00
scribu
cc34c8aef4 Inline docs for WP_Tax_Query. See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-10 08:20:46 +00:00
scribu
ffb54b11c2 Fix notice in get_queried_object(). See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-10 07:51:04 +00:00
scribu
ce9b9a9e78 Always have a WP_Tax_Query instance, to prevent notices. See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-09 19:42:25 +00:00
scribu
e5690e7ebe Introduce WP_Tax_Query. Fix canonical redirects in the process. See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-09 19:29:21 +00:00
scribu
905f5bf810 Proper check for tax query, which will never be empty, due to 'relation'. See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-09 17:09:42 +00:00
scribu
e11b831338 Set tax query defaults earlier, for notice prevention and convenience. See #15752
git-svn-id: http://svn.automattic.com/wordpress/trunk@16843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-09 17:05:40 +00:00
scribu
474c3f0672 Clarify is_single() inline doc. Fixes #14034
git-svn-id: http://svn.automattic.com/wordpress/trunk@16830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-09 05:27:37 +00:00
markjaquith
298c858c5b Use is_page_type_hierarchical(). props nacin. see #15140
git-svn-id: http://svn.automattic.com/wordpress/trunk@16819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-08 21:17:01 +00:00
markjaquith
218867ff3c Do not do slug logging/redirects for hierarchical post types. see #15140
git-svn-id: http://svn.automattic.com/wordpress/trunk@16818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-08 21:10:38 +00:00
scribu
39d0718bff Set queried object on CPT archives. Fixes #15730
git-svn-id: http://svn.automattic.com/wordpress/trunk@16792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-08 08:57:38 +00:00
markjaquith
f23d5de358 Cast to array, to avoid notices. props hakre. fixes #14997
git-svn-id: http://svn.automattic.com/wordpress/trunk@16576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-24 20:34:22 +00:00
scribu
d941809a3c Remove debug cruft from [16543]. See #14590
git-svn-id: http://svn.automattic.com/wordpress/trunk@16544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-23 00:49:23 +00:00
scribu
696bfb5fc6 Minor cleanup in queried object setting logic. See #14590
git-svn-id: http://svn.automattic.com/wordpress/trunk@16543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-23 00:47:45 +00:00
nacin
53a2e0667e Cast term_id to int for queried_object_id. props wojtek.szkutnik, fixes #14590.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-23 00:32:19 +00:00
scribu
f93ca9618a Prevent notice when checking for hierarchical tax rewrite. Props demetris. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-22 21:56:20 +00:00
scribu
06c1418787 Consider only IN tax queries when returning the queried object. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-22 05:14:47 +00:00
scribu
0a1d745a54 Move s/ /+ out of WP_Query, so that 'category_name=Some Category' works again. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-21 16:33:05 +00:00
scribu
cbd4ea48ca Don't do any taxonomy stuff if is_singular. See #15487
git-svn-id: http://svn.automattic.com/wordpress/trunk@16515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-20 21:51:21 +00:00
ryan
66d34fa710 array_unique() category__in and category__not_in to eliminate dupes from multiple runs of parse_tax_query(). Fixes canonical redirects for cat, category__in, and category__not_in requests. see #12891 #15487
git-svn-id: http://svn.automattic.com/wordpress/trunk@16513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-20 21:43:19 +00:00
scribu
36658f37ca Fix logic for when excluding a non-existant term. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-20 21:28:50 +00:00
ryan
44733f9635 If the queried term does not exist make sure no posts are returned in the query rather than falling through to querying all posts. Fixes 404s when querying cats that do not exist. see #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-20 21:10:20 +00:00
scribu
b21ec2cbd5 Remove debug cruft from [16505]. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-20 13:48:24 +00:00
scribu
7f59d20fb5 Don't set post_type to 'any' for category and tag queries. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-20 13:39:07 +00:00
markjaquith
d1d83710e7 Do not set is_category/is_tax/is_tax for is_singular requests. props mtekk. fixes #15487
git-svn-id: http://svn.automattic.com/wordpress/trunk@16495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-19 19:25:53 +00:00
scribu
7879bcaee5 Force GROUP BY when there's a tax query. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-19 09:17:59 +00:00
nacin
695644cc72 Allow is_feed() to drill down the feed being checked. props johnbillion for initial patch, fixes #15460.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-18 03:19:08 +00:00
ryan
847499e531 Pinking shears
git-svn-id: http://svn.automattic.com/wordpress/trunk@16438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-17 18:47:34 +00:00
scribu
275888f2e6 Re-introduce ->tax_query as a read-only var. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-17 02:04:08 +00:00
scribu
f58b21e69d Optimize get_tax_sql(). See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-17 01:56:01 +00:00
scribu
8b107e23f4 Revert [16402] outright. Causes issues with themes. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-16 16:36:20 +00:00
scribu
690cd434d1 Don't pollute the 'tax_query' query var. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-16 16:22:09 +00:00
scribu
e55bee786e Revert [16384]. See #15433
git-svn-id: http://svn.automattic.com/wordpress/trunk@16385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-15 15:23:04 +00:00
scribu
b20d93c69c Ignore 'name' qv if 'p' qv is set. Fixes #15433
git-svn-id: http://svn.automattic.com/wordpress/trunk@16384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-15 13:33:16 +00:00
scribu
cc72395bbb Set 'taxonomy' and 'term' query vars for back-compat. Fixes #12659
git-svn-id: http://svn.automattic.com/wordpress/trunk@16381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-15 10:51:39 +00:00
scribu
7cb5240bd6 Re-parse tax query just before calling get_tax_sql(). Fixes #15161
git-svn-id: http://svn.automattic.com/wordpress/trunk@16380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-15 10:11:25 +00:00
scribu
6b2aa2177f Update doc for WP_Query::post. Fixes #15105
git-svn-id: http://svn.automattic.com/wordpress/trunk@16360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-13 23:32:18 +00:00
scribu
40b2c5b6c5 Kill WP_Object_Query. See #15032
git-svn-id: http://svn.automattic.com/wordpress/trunk@16353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-13 18:32:43 +00:00
scribu
cd60463f36 Revert most of [16018]. See #15032
git-svn-id: http://svn.automattic.com/wordpress/trunk@16352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-13 18:26:15 +00:00
ryan
3a4671f530 Prevent stomping of global. Props prettyboymp. fixes #13945
git-svn-id: http://svn.automattic.com/wordpress/trunk@16303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-11 16:22:18 +00:00
scribu
8885e4f78e Add context to get_meta_sql(). See #15018
git-svn-id: http://svn.automattic.com/wordpress/trunk@16286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-11 10:06:05 +00:00
nacin
8b6cb32160 Ensure we have a valid post type object when checking for has_archive. props filosofo, fixes #15364.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-10 16:42:59 +00:00
scribu
3cbc8ef308 Make get_tax_sql() a standalone function. See #15032
git-svn-id: http://svn.automattic.com/wordpress/trunk@16267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-09 23:30:35 +00:00
scribu
db1d9369eb Make get_meta_sql() a standalone function. See #15032
git-svn-id: http://svn.automattic.com/wordpress/trunk@16266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-09 23:22:13 +00:00
scribu
e9952075ee Allow mix of 'taxonomy' => 'foo', 'term' => 'bar' and 'foo2' => 'bar2'. Props filosofo. Fixes #15363
git-svn-id: http://svn.automattic.com/wordpress/trunk@16259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-09 16:45:51 +00:00
scribu
3a7d16a308 Set 'operator' field. Fixes #15350. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-09 12:27:03 +00:00
scribu
158a07459d Use wp_basename() in WP_Query too. See #11887
git-svn-id: http://svn.automattic.com/wordpress/trunk@16155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-02 17:28:28 +00:00
scribu
d2e8b78a42 Just pass meta type to get_meta_sql(). See #15032
git-svn-id: http://svn.automattic.com/wordpress/trunk@16143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-01 20:34:54 +00:00
scribu
7f7d5e3c75 Remove check on unexistant $ids var in WP_Query::get_posts. Props Utkarsh. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@16116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-31 11:28:49 +00:00