The read_post cap cannot be checked for sticky posts because not logged in users don't have any caps. see #11197
git-svn-id: https://develop.svn.wordpress.org/trunk@14245 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
981960fa09
commit
3e9cc3ebd9
|
@ -2486,7 +2486,7 @@ class WP_Query {
|
||||||
$stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in) $stickies_where" );
|
$stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in) $stickies_where" );
|
||||||
foreach ( $stickies as $sticky_post ) {
|
foreach ( $stickies as $sticky_post ) {
|
||||||
// Ignore sticky posts the current user cannot read or are not published.
|
// Ignore sticky posts the current user cannot read or are not published.
|
||||||
if ( !current_user_can('read_post', $sticky_post->ID) || 'publish' != $sticky_post->post_status )
|
if ( 'publish' != $sticky_post->post_status )
|
||||||
continue;
|
continue;
|
||||||
array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
|
array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
|
||||||
$sticky_offset++;
|
$sticky_offset++;
|
||||||
|
|
Loading…
Reference in New Issue