pre_get_posts query order not the same
-
I have a custom post-type called “scholars” and I’m sorting the archive with the
pre_get_postshook, like so:add_action('pre_get_posts', 'my_queries'); function my_queries($query) { if (!$query->is_main_query()) return; if ($query->is_post_type_archive('scholars')) { $query->set('posts_per_page', -1); $query->set('meta_key', 'year'); $query->set('orderby', 'meta_value_num'); } }It works just fine in the archive page, posts are ordered by year but then I use the plugin in the single page and the order is not the same, I can’t even tell what the order is TBH, is not by date, is not by custom meta apparently. What could be the problem?
<nav class="scholars-navigation"> <span class="prev"><?php previous_post_link_plus('meta_key=year&order_by=numeric') ?></span> <h2><?php the_title() ?></h2> <span class="next"><?php next_post_link_plus('meta_key=year&order_by=numeric') ?></span> </nav>http://ww.wp.xz.cn/plugins/ambrosite-nextprevious-post-link-plus/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘pre_get_posts query order not the same’ is closed to new replies.