diff --git wp-includes/class-wp-query.php wp-includes/class-wp-query.php
index baefec7..e6f5899 100644
|
|
class WP_Query { |
690 | 690 | * passed. To use 'meta_value', or 'meta_value_num', |
691 | 691 | * 'meta_key=keyname' must be also be defined. To sort by a |
692 | 692 | * specific `$meta_query` clause, use that clause's array key. |
693 | | * Accepts 'none', 'name', 'author', 'date', 'title', |
694 | | * 'modified', 'menu_order', 'parent', 'ID', 'rand', |
695 | | * 'relevance', 'RAND(x)' (where 'x' is an integer seed value), |
| 693 | * Default 'date'. Accepts 'none', 'name', 'author', 'date', |
| 694 | * 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', |
| 695 | * 'RAND(x)' (where 'x' is an integer seed value), |
696 | 696 | * 'comment_count', 'meta_value', 'meta_value_num', 'post__in', |
697 | 697 | * 'post_name__in', 'post_parent__in', and the array keys |
698 | | * of `$meta_query`. Default is 'date', except when a search |
699 | | * is being performed, when the default is 'relevance'. |
700 | | * |
| 698 | * of `$meta_query`. |
701 | 699 | * @type int $p Post ID. |
702 | 700 | * @type int $page Show the number of posts that would show up on page X of a |
703 | 701 | * static front page. |
… |
… |
class WP_Query { |
1713 | 1711 | $page = 1; |
1714 | 1712 | |
1715 | 1713 | if ( isset( $q['caller_get_posts'] ) ) { |
1716 | | _deprecated_argument( 'WP_Query', '3.1.0', |
1717 | | /* translators: 1: caller_get_posts, 2: ignore_sticky_posts */ |
1718 | | sprintf( __( '%1$s is deprecated. Use %2$s instead.' ), |
1719 | | '<code>caller_get_posts</code>', |
1720 | | '<code>ignore_sticky_posts</code>' |
1721 | | ) |
1722 | | ); |
1723 | | |
1724 | | if ( ! isset( $q['ignore_sticky_posts'] ) ) { |
| 1714 | _deprecated_argument( 'WP_Query', '3.1.0', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) ); |
| 1715 | if ( !isset( $q['ignore_sticky_posts'] ) ) |
1725 | 1716 | $q['ignore_sticky_posts'] = $q['caller_get_posts']; |
1726 | | } |
1727 | 1717 | } |
1728 | 1718 | |
1729 | 1719 | if ( !isset( $q['ignore_sticky_posts'] ) ) |
… |
… |
class WP_Query { |
2297 | 2287 | $user_id = get_current_user_id(); |
2298 | 2288 | |
2299 | 2289 | $q_status = array(); |
| 2290 | |
2300 | 2291 | if ( ! empty( $q['post_status'] ) ) { |
| 2292 | |
2301 | 2293 | $statuswheres = array(); |
2302 | 2294 | $q_status = $q['post_status']; |
2303 | 2295 | if ( ! is_array( $q_status ) ) |
… |
… |
class WP_Query { |
2356 | 2348 | $where .= " AND ($where_status)"; |
2357 | 2349 | } |
2358 | 2350 | } elseif ( !$this->is_singular ) { |
2359 | | $where .= " AND ({$wpdb->posts}.post_status = 'publish'"; |
| 2351 | |
| 2352 | $where_status[] = 'publish'; |
2360 | 2353 | |
2361 | 2354 | // Add public states. |
2362 | 2355 | $public_states = get_post_stati( array('public' => true) ); |
2363 | 2356 | foreach ( (array) $public_states as $state ) { |
2364 | 2357 | if ( 'publish' == $state ) // Publish is hard-coded above. |
2365 | 2358 | continue; |
2366 | | $where .= " OR {$wpdb->posts}.post_status = '$state'"; |
| 2359 | $where_status[] = $state; |
2367 | 2360 | } |
2368 | 2361 | |
2369 | 2362 | if ( $this->is_admin ) { |
2370 | 2363 | // Add protected states that should show in the admin all list. |
2371 | 2364 | $admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) ); |
2372 | 2365 | foreach ( (array) $admin_all_states as $state ) { |
2373 | | $where .= " OR {$wpdb->posts}.post_status = '$state'"; |
| 2366 | $where_status[] = $state; |
2374 | 2367 | } |
2375 | 2368 | } |
2376 | 2369 | |
… |
… |
class WP_Query { |
2378 | 2371 | // Add private states that are limited to viewing by the author of a post or someone who has caps to read private states. |
2379 | 2372 | $private_states = get_post_stati( array('private' => true) ); |
2380 | 2373 | foreach ( (array) $private_states as $state ) { |
2381 | | $where .= current_user_can( $read_private_cap ) ? " OR {$wpdb->posts}.post_status = '$state'" : " OR {$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$state'"; |
| 2374 | $where_status[] = $state; |
| 2375 | $where_post_author = current_user_can( $read_private_cap ) ? "" : " OR {$wpdb->posts}.post_author = $user_id"; |
2382 | 2376 | } |
2383 | 2377 | } |
2384 | | |
| 2378 | $where .= " AND ( {$wpdb->posts}.post_status IN ('" . implode("','",$where_status) . "')"; |
| 2379 | $where .= $where_post_author; |
2385 | 2380 | $where .= ')'; |
2386 | 2381 | } |
2387 | 2382 | |
… |
… |
class WP_Query { |
2390 | 2385 | * manipulations to them are reflected in the paging by day queries. |
2391 | 2386 | */ |
2392 | 2387 | if ( !$q['suppress_filters'] ) { |
| 2388 | |
2393 | 2389 | /** |
2394 | 2390 | * Filters the WHERE clause of the query. |
2395 | 2391 | * |
… |
… |
class WP_Query { |
2410 | 2406 | */ |
2411 | 2407 | $join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) ); |
2412 | 2408 | } |
2413 | | |
| 2409 | |
2414 | 2410 | // Paging |
2415 | 2411 | if ( empty($q['nopaging']) && !$this->is_singular ) { |
2416 | 2412 | $page = absint($q['paged']); |
… |
… |
class WP_Query { |
2519 | 2515 | * manipulate paging queries should use these hooks. |
2520 | 2516 | */ |
2521 | 2517 | if ( !$q['suppress_filters'] ) { |
| 2518 | |
2522 | 2519 | /** |
2523 | 2520 | * Filters the WHERE clause of the query. |
2524 | 2521 | * |
… |
… |
class WP_Query { |
2631 | 2628 | * Regular plugins should use the hooks above. |
2632 | 2629 | */ |
2633 | 2630 | if ( !$q['suppress_filters'] ) { |
| 2631 | |
2634 | 2632 | /** |
2635 | 2633 | * Filters the WHERE clause of the query. |
2636 | 2634 | * |
… |
… |
class WP_Query { |
2751 | 2749 | $this->request = $old_request = "SELECT $found_rows $distinct $fields FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits"; |
2752 | 2750 | |
2753 | 2751 | if ( !$q['suppress_filters'] ) { |
| 2752 | |
2754 | 2753 | /** |
2755 | 2754 | * Filters the completed SQL query before sending. |
2756 | 2755 | * |
… |
… |
class WP_Query { |
3239 | 3238 | * @since 1.5.0 |
3240 | 3239 | * @access public |
3241 | 3240 | * |
3242 | | * @param string|array $query URL query string or array of query arguments. |
| 3241 | * @param string $query URL query string. |
3243 | 3242 | * @return array List of posts. |
3244 | 3243 | */ |
3245 | 3244 | public function query( $query ) { |
… |
… |
class WP_Query { |
3872 | 3871 | } |
3873 | 3872 | |
3874 | 3873 | /** |
3875 | | * Is the query for an existing single post of any post type (post, attachment, page, |
3876 | | * custom post types)? |
| 3874 | * Is the query for an existing single post of any post type (post, attachment, page, ... )? |
3877 | 3875 | * |
3878 | 3876 | * If the $post_types parameter is specified, this function will additionally |
3879 | 3877 | * check if the query is for one of the Posts Types specified. |