different roles for different restrictions
-
<?php // USER ROLE TO CATEGORY add_action( 'pre_get_posts', 'blue_show_user_posts'); function blue_show_user_posts( $query ){ if ( current_user_can( 'administrator' ) ) return; if( is_user_logged_in() && $query->is_main_query() ){ $current_user = wp_get_current_user(); $query->set( 'blue', $current_user->ID );} if( $query->is_main_query() ) { $query->set( 'category__not_in', (array( 28, 24, 33, 32, 31)) ); } return $query;}?>
Well this code works. Now i need another Role added to it:
Blue can see no Category 28, 24, 33, 32, 31
Red can see no Category 41, 42, 43, 44, 56
Yellow can see no Category 53, 54, 57Can you help me adding the code in the above?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘different roles for different restrictions’ is closed to new replies.