The value of get_option('sticky_posts') includes those that are in the trash. How can I get a value minus stickies that are in the trash?
var $stickies = count(get_option('sticky_posts'));
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
Why is that even happening aside, from quick look at core it does the following to achieve that in
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) );