Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. switch( $_GET['orderby'] ) {
  2.  
  3. case 'eval_workshop_date':
  4. $mq = array(
  5. 'relation' => 'OR',
  6.  
  7. 'individual' => array(
  8. 'key' => 'workshop_or_individual_clients',
  9. 'value' => 'A workshop',
  10. 'compare' => '!='
  11. ),
  12.  
  13. 'workshop_date' => array(
  14. 'key' => 'workshop_completion_date',
  15. 'value' => '',
  16. 'compare' => '!='
  17. ),
  18. );
  19.  
  20. // Add existing meta query back in if it exists
  21. if ( $query->get( 'meta_query' ) ) {
  22. $mq = array(
  23. 'relation' => 'AND',
  24. $mq,
  25. $query->get( 'meta_query' )
  26. );
  27. }
  28.  
  29. // Set the meta query
  30. $query->set( 'meta_query', $mq );
  31.  
  32. // Change it to order by our new meta query options
  33. $query->set( 'orderby', array(
  34. 'individual' => 'DESC',
  35. 'workshop_date' => 'DESC'
  36. ));
  37. break;
  38. }
  39.  
  40. SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_posts.*
  41. FROM wp_posts
  42. INNER JOIN wp_postmeta
  43. ON ( wp_posts.ID = wp_postmeta.post_id )
  44. INNER JOIN wp_postmeta AS mt1
  45. ON ( wp_posts.ID = mt1.post_id )
  46. INNER JOIN wp_postmeta AS a
  47. ON ( a.post_id = wp_posts.ID )
  48. INNER JOIN wp_postmeta AS b
  49. ON ( ( b.meta_id = a.meta_id + @@auto_increment_increment )
  50. AND ( b.post_id = wp_posts.ID ) )
  51. INNER JOIN wp_posts AS c
  52. ON ( ( c.post_type = 'acf-field' )
  53. AND ( ( c.post_content LIKE '%:"text"%' )
  54. OR ( c.post_content LIKE '%:"textarea"%' )
  55. OR ( c.post_content LIKE '%:"wysiwyg"%' ) ) )
  56. WHERE 1 = 1
  57. AND ( ( ( c.post_name = b.meta_value )
  58. AND ( a.meta_value LIKE '%Workshop%' )
  59. AND ( a.meta_value LIKE '%5%' ) )
  60. OR ( ( ( wp_posts.post_title LIKE '%Workshop%' )
  61. OR ( wp_posts.post_content LIKE '%Workshop%' )
  62. OR ( wp_posts.post_excerpt LIKE '%Workshop%' ) )
  63. AND ( ( wp_posts.post_title LIKE '%5%' )
  64. OR ( wp_posts.post_content LIKE '%5%' )
  65. OR ( wp_posts.post_excerpt LIKE '%5%' ) ) ) )
  66. AND ( ( wp_postmeta.meta_key = 'workshop_or_individual_clients'
  67. AND wp_postmeta.meta_value != 'A workshop' )
  68. OR ( mt1.meta_key = 'workshop_completion_date'
  69. AND mt1.meta_value != '' ) )
  70. AND wp_posts.post_type = 'dtl-evaluation'
  71. AND ( wp_posts.post_status = 'publish'
  72. OR wp_posts.post_status = 'acf-disabled'
  73. OR wp_posts.post_status = 'future'
  74. OR wp_posts.post_status = 'draft'
  75. OR wp_posts.post_status = 'pending'
  76. OR wp_posts.post_status = 'private' )
  77. GROUP BY wp_posts.ID
  78. ORDER BY CAST(wp_postmeta.meta_value AS CHAR) DESC,
  79. CAST(mt1.meta_value AS CHAR) DESC,
  80. wp_posts.post_date DESC
  81. LIMIT 0, 20
  82.  
  83. +-----------------------+------------------------------------+---------+
  84. | Column | Type | Comment |
  85. +-----------------------+------------------------------------+---------+
  86. | ID | bigint(20) unsigned Auto Increment | |
  87. | post_author | bigint(20) unsigned [0] | |
  88. | post_date | datetime [0000-00-00 00:00:00] | |
  89. | post_date_gmt | datetime [0000-00-00 00:00:00] | |
  90. | post_content | longtext | |
  91. | post_title | text | |
  92. | post_excerpt | text | |
  93. | post_status | varchar(20) [publish] | |
  94. | comment_status | varchar(20) [open] | |
  95. | ping_status | varchar(20) [open] | |
  96. | post_password | varchar(255) [] | |
  97. | post_name | varchar(200) [] | |
  98. | to_ping | text | |
  99. | pinged | text | |
  100. | post_modified | datetime [0000-00-00 00:00:00] | |
  101. | post_modified_gmt | datetime [0000-00-00 00:00:00] | |
  102. | post_content_filtered | longtext | |
  103. | post_parent | bigint(20) unsigned [0] | |
  104. | guid | varchar(255) [] | |
  105. | menu_order | int(11) [0] | |
  106. | post_type | varchar(20) [post] | |
  107. | post_mime_type | varchar(100) [] | |
  108. | comment_count | bigint(20) [0] | |
  109. +-----------------------+------------------------------------+---------+
  110.  
  111. Keys:
  112. +---------+---------------------------------------+
  113. | PRIMARY | ID |
  114. +---------+---------------------------------------+
  115. | INDEX | post_name(191) |
  116. | INDEX | post_type, post_status, post_date, ID |
  117. | INDEX | post_parent |
  118. | INDEX | post_author |
  119. +---------+---------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement