SHARE
TWEET

Untitled

a guest Jul 12th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function display_custom_posts_sorted_by_date($query) {
  2.     if (is_admin()) {
  3.         if (isset($query->query_vars['post_type'])) {
  4.             if ($query->query_vars['post_type'] == 'courses') {
  5.                 $query->set('meta_key', 'online_start');
  6.                 $query->set('orderby', 'meta_value');
  7.                 $query->set('order', 'DESC');
  8.             }
  9.         }
  10.     }
  11. }
  12. add_filter('pre_get_posts' , 'display_custom_posts_sorted_by_date');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top