Orderby = rand not working
-
Hi all,
I recently migrated my site from old hosting company to WPEngine. Everything came over fine, except my CPT aren’t ordered randomly, like they are on my old site. Now they are ordered oldest to newest. I believe the culprit is this function not working:
global $wp_query; $paged = $wp_query->query_vars['page'] ? $wp_query->query_vars['page'] : get_query_var('paged'); remove_all_filters('posts_orderby'); $search_array = array( 'post_type' => 'inventory', 'post_status' => isset($atts['post_status'])?$atts['post_status']:'publish', 'pagename' => '', 'name' => '', 'page_id' => '', 'p' => '', 'paged' => $paged, 'posts_per_page' => $_GET['posts_per_page'], 'orderby' => 'rand' );I don’t know why it would work on one site and not my new one. The only thing I can think of is that WPEngine supports a newer PHP and I will need to update this code. But I’m not great with PHP, and that is just an educated guess.
Any help would be appreciated!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Orderby = rand not working’ is closed to new replies.