eventsmanager

Show only user created event when user capability edit_others_events is OFF

Jan 19th, 2026
5,096
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. <?php
  2.  
  3. function my_parse_query(){
  4. global $wp_query;
  5. if( is_admin() && !empty( $wp_query ) && !current_user_can('edit_others_events') ) {
  6. $user = wp_get_current_user();
  7. $wp_query->query_vars['author__in'] = array($user->ID);
  8. }
  9. }
  10.  
  11. add_filter('parse_query', 'my_parse_query', 100 );
Advertisement