Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. global $current_user;
  2.  
  3. $user_roles = $current_user->roles;
  4.  
  5. $user_role_query = array();
  6.  
  7. for ($i=0; $i < sizeof($user_roles); $i++) {
  8. $user_role_query[] = array('key'=>'attribution_roles', 'value' => $user_roles[$i], 'compare'=>'LIKE');
  9. }
  10.  
  11. // WP_Query arguments
  12. $args = array (
  13. 'post_type' => 'suivi_des_comites',
  14. 'order' => 'ASC',
  15. 'orderby' => 'title',
  16. 'posts_per_page' => -1,
  17. 'meta_query' => array_merge(
  18. array( 'relation' => 'OR' ), // this must be an array
  19. $user_role_query
  20. )
  21. );
  22.  
  23. Array
  24. (
  25. [0] => Array
  26. (
  27. [key] => attribution_roles
  28. [value] => aptnb
  29. [compare] => LIKE
  30. )
  31.  
  32. )
  33.  
  34. Array
  35. (
  36. [post_type] => suivi_des_comites
  37. [order] => ASC
  38. [orderby] => title
  39. [posts_per_page] => -1
  40. [meta_query] => Array
  41. (
  42. [relation] => OR
  43. [0] => Array
  44. (
  45. [key] => attribution_roles
  46. [value] => aptnb
  47. [compare] => LIKE
  48. )
  49.  
  50. )
  51.  
  52. )
  53.  
  54. a:2:{i:0;s:8:"aptnb_ca";i:1;s:13:"administrator";}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement