Advertisement
eventsmanager

dashboard events list scope

Jun 9th, 2014
692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. add_action( 'pre_get_posts', 'parse_query_change_scope' );
  2. function parse_query_change_scope($query){
  3. if( is_admin() ){
  4. if( !empty($query->query_vars['post_type']) && ($query->query_vars['post_type'] == EM_POST_TYPE_EVENT || $query->query_vars['post_type'] == 'event-recurring') && (empty($query->query_vars['post_status']) || !in_array($query->query_vars['post_status'],array('trash','pending','draft'))) ) {
  5. if(!empty($_REQUEST['scope'])) :
  6. $scope = $_REQUEST['scope'];
  7. else :
  8. $scope = 'all';
  9. $_REQUEST['scope'] = 'all';
  10. endif;
  11. $query->query_vars['scope'] = $scope;
  12. }
  13. return $query;
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement