Custom Post types, 3.1 and sorting by custom meta_key in Admin
-
We have a custom post type which has a custom meta_key called “order”.
I’m using:
add_filter( 'parse_query', 'sort_by_order' ); function sort_by_order($query){ global $pagenow; if (is_admin() && $pagenow =='edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'banners') { $query->query_vars['orderby'] = 'meta_value_num'; $query->query_vars['meta_key'] = 'order'; $query->query_vars['order'] = 'ASC'; } }
Which worked great before the install. I get “No posts found” even though it says there are 25 published posts in the post type.
Any ideas on a fix?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Custom Post types, 3.1 and sorting by custom meta_key in Admin’ is closed to new replies.