Skip to content

Commit 93680ad

Browse files
committed
Rename caller_get_posts WP_Query flag to ignore_sticky_posts, because that is the only thing it does. fixes #14624. props scribu
git-svn-id: https://develop.svn.wordpress.org/trunk@15589 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d901f3a commit 93680ad

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

wp-includes/default-widgets.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ function widget($args, $instance) {
542542
else if ( $number > 15 )
543543
$number = 15;
544544

545-
$r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
545+
$r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
546546
if ($r->have_posts()) :
547547
?>
548548
<?php echo $before_widget; ?>

wp-includes/post.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ function get_posts($args = null) {
11221122
} elseif ( ! empty($r['exclude']) )
11231123
$r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
11241124

1125-
$r['caller_get_posts'] = true;
1125+
$r['ignore_sticky_posts'] = true;
11261126
$r['no_found_rows'] = true;
11271127

11281128
$get_posts = new WP_Query;

wp-includes/query.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,8 +1540,14 @@ function &get_posts() {
15401540
$post_status_join = false;
15411541
$page = 1;
15421542

1543-
if ( !isset($q['caller_get_posts']) )
1544-
$q['caller_get_posts'] = false;
1543+
if ( isset( $q['caller_get_posts'] ) ) {
1544+
_deprecated_argument( 'WP_Query', '3.1', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) );
1545+
if ( !isset( $q['ignore_sticky_posts'] ) )
1546+
$q['ignore_sticky_posts'] = $q['caller_get_posts'];
1547+
}
1548+
1549+
if ( !isset( $q['ignore_sticky_posts'] ) )
1550+
$q['ignore_sticky_posts'] = false;
15451551

15461552
if ( !isset($q['suppress_filters']) )
15471553
$q['suppress_filters'] = false;
@@ -2377,7 +2383,7 @@ function &get_posts() {
23772383

23782384
// Put sticky posts at the top of the posts array
23792385
$sticky_posts = get_option('sticky_posts');
2380-
if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['caller_get_posts'] ) {
2386+
if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) {
23812387
$num_posts = count($this->posts);
23822388
$sticky_offset = 0;
23832389
// Loop over posts and relocate stickies to the front.

0 commit comments

Comments
 (0)