Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. $allProjectArgs = array(
  2. 'post_type' => 'project',
  3. 'post_status' => 'publish',
  4. 'posts_per_page'=> -1,
  5. 'orderby' => 'favorit_users',
  6. 'order' => 'DESC',
  7. 'meta_query' => array(
  8. 'relation' => 'OR',
  9. array(
  10. 'relation' => 'OR',
  11. array(
  12. 'key' => 'project_users', // name of custom field
  13. 'value' => '"'.get_current_user_id().'"',
  14. 'compare' => 'NOT LIKE'
  15. ),
  16. array(
  17. 'key' => 'project_users', // name of custom field
  18. 'compare' => 'NOT EXISTS'
  19. ),
  20. ),
  21. array(
  22. 'relation' => 'AND',
  23. array(
  24. 'relation' => 'OR',
  25. array(
  26. 'key' => 'project_users', // name of custom field
  27. 'value' => get_current_user_id(),
  28. 'compare' => 'NOT LIKE'
  29. ),
  30. array(
  31. 'key' => 'project_users', // name of custom field
  32. 'compare' => 'NOT EXISTS'
  33. ),
  34. ),
  35. array(
  36. 'relation' => 'AND',
  37. 'favorit_users' => array(
  38. 'key' => 'favorite_users',
  39. 'value' => get_current_user_id(),
  40. 'compare' => 'LIKE'
  41. ),
  42. ),
  43. ),
  44. // array(
  45. // 'relation' => 'OR',
  46. // array(
  47. // "favorit_users" => array(
  48. // 'key' => 'favorite_users',
  49. // 'value' => get_current_user_id(),
  50. // 'compare' => 'LIKE'
  51. // ),
  52. // ),
  53. // ),
  54. ),
  55. );
  56. $allProjectQuery = new WP_Query($allProjectArgs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement