Сортировка сообщений с метаданной не работает

Я хочу получить большинство популярных сообщений на основе метазначения 'view_count', ниже код не работает, я получаю некоторые случайные сообщения, где я делаю это неправильно?

<?php $mostpopular_args=array( 'post_type' => 'post', 'orderby' => 'meta_value_num', 'meta_key' => 'view_count', 'posts_per_page' => '10', ); ?> <?php $mostpopular_pick = new WP_Query($mostpopular_args); ?> <?php if($mostpopular_pick->have_posts() ): ?> <?php while($mostpopular_pick->have_posts()): $mostpopular_pick->the_post(); ?> <article class="widget-article"> <a href ="<?php the_permalink(); ?>"> <div class="widget-article-thumb"> <?php if(has_post_thumbnail()){ ?> <?php $page_thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'featuredsmall'); ?> <img src="<?php echo $page_thumb[0]; ?>" alt="" /> <?php } ?> </div> </a> <div class="widget-content-wrapper"> <h3 class="widget-article-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> </div> </article> <?php endwhile; ?> <?php endif; ?> 

И это код для обновления количества просмотров в файле single.php

 <?php $count = get_post_meta(get_the_ID(),'view_count',true);?> <?php update_post_meta(get_the_ID(),'view_count',$count+1,$count); ?> 

Должен ли я сбросить запрос где-нибудь?

Обновление: вот мой код single.php

 <?php get_header(); ?> <div class="main-content col-md-8" role="main"> <?php while( have_posts() ) : the_post(); ?> <?php $count = (int) get_post_meta(get_the_ID(),'view_count',true);?> <?php update_post_meta(get_the_ID(),'view_count',$count+1,$count); ?> <?php get_template_part( 'article'); ?> <?php endwhile; ?> <?php wp_reset_postdata(); ?> </div> <!-- end main-content --> <?php get_sidebar(); ?> <?php get_footer(); ?> 

И код article.php,

 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <!-- Article header --> <header class="entry-header"> <?php if(is_single()): ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php else: ?> <h3 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <?php endif; ?> <div class="entry-meta"> <?php // Get the date. echo '<div class="meta-date"> ' . get_the_date() . ' </div>'; ?> <div class="meta-author"> <div class="author-avatar"> <?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?> </div> <?php // Get the post author. printf( '<div class="meta-author"><a href="%1$s" rel="author">%2$s</a></div>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); ?> </div> </div> </header> <!-- end entry-header --> <div class="shares-and-views"> <div class="shares clearfix"> <div aria-hidden="true" class="bigshare icon icon-share-alt"></div> <?php $fb_share_count = (int) get_post_meta(get_the_ID(),'cb_fb_share_count',true); ?> <?php $tweet_share_count = (int) get_post_meta(get_the_ID(),'cb_tweet_share_count',true); ?> <?php $total_count = $fb_share_count + $tweet_share_count; ?> <div class="cb-share-count"><?php echo $total_count; ?></div> <?php do_action("mashshare"); ?> </div> <div class="view-count" class="pull-right"> <span class="icon icon-eye2" style="margin-left:10px" aria-hidden="true"></span> <span class="share-text"> <strong><?php echo get_post_meta(get_the_ID(),'view_count',true); ?></strong> VIEWS </span> </div> </div> <a href ="<?php the_permalink(); ?>"> <div class="article-thumb"> <?php if(has_post_thumbnail()){ ?> <?php $page_thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'featuredbig'); ?> <img src="<?php echo $page_thumb[0]; ?>" alt="" /> <?php } ?> </div> </a> <!-- Article content --> <div class="entry-content"> <div class="content-wrapper"> <?php if ( is_single() ):?> <div id="single-page-content"> <?php the_content(); ?> </div> <?php the_tags(); ?> <?php //comments_template(); ?> <?php $include_categores = wp_get_post_categories( get_the_ID()); $post_not_in = array(); $post_not_in[] = get_the_ID(); $related_args=array( 'post_type' => 'post', 'post__not_in' => $post_not_in, 'category__in' => $include_categores, 'posts_per_page' => '10', ); $related_posts = new WP_Query($related_args); ?> <div class="related-articles"> <div class="row"> <div class="col-xs-12"> <h3 class="related-title"><?php _e('Related Articles','patrika');?></h3> </div> </div> <div class="row"> <?php while($related_posts->have_posts()): $related_posts->the_post(); ?> <article class="related-article col-sm-6"> <a href ="<?php the_permalink(); ?>"> <div class="related-article-thumb"> <?php if(has_post_thumbnail()){ ?> <?php $page_thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'featuredsmall'); ?> <img src="<?php echo $page_thumb[0]; ?>" alt="" /> <?php } ?> </div> </a> <h4 class="related-article-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <!--<div class="only-count"> <div class="icon icon-share-alt" aria-hidden="true"></div> <?php echo do_shortcode('[mashshare shares="true" buttons="false"]'); ?> <div class="share-text">SHARES</div> </div>--> </article> <?php endwhile; ?> <?php wp_reset_postdata(); ?> </div> </div> <?php else: ?> <?php the_excerpt(); ?> <?php endif; ?> </div> </div> <!-- end entry-content --> <!-- Article footer --> <footer class="entry-footer"> <?php // If we have a single page and the author bio exists, display it if ( is_single() && get_the_author_meta( 'description' ) ) { echo '<h2>' . __( 'Written by ', 'alpha' ) . get_the_author() . '</h2>'; echo '<p>' . the_author_meta( 'description' ) . '</p>'; } ?> </footer> <!-- end entry-footer --> </article>