Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $current_user;
- $user_roles = $current_user->roles;
- $user_role_query = array();
- for ($i=0; $i < sizeof($user_roles); $i++) {
- $user_role_query[] = array('key'=>'attribution_roles', 'value' => $user_roles[$i], 'compare'=>'LIKE');
- }
- // WP_Query arguments
- $args = array (
- 'post_type' => 'suivi_des_comites',
- 'order' => 'ASC',
- 'orderby' => 'title',
- 'posts_per_page' => -1,
- 'meta_query' => array_merge(
- array( 'relation' => 'OR' ), // this must be an array
- $user_role_query
- )
- );
- Array
- (
- [0] => Array
- (
- [key] => attribution_roles
- [value] => aptnb
- [compare] => LIKE
- )
- )
- Array
- (
- [post_type] => suivi_des_comites
- [order] => ASC
- [orderby] => title
- [posts_per_page] => -1
- [meta_query] => Array
- (
- [relation] => OR
- [0] => Array
- (
- [key] => attribution_roles
- [value] => aptnb
- [compare] => LIKE
- )
- )
- )
- a:2:{i:0;s:8:"aptnb_ca";i:1;s:13:"administrator";}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement