LLMS_Shortcode_Courses::get_tax_query()
Retrieve the tax query based on submitted category & visibility
Return Return
(array|string)
Source Source
File: includes/shortcodes/class.llms.shortcode.courses.php
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | protected function get_tax_query() { $has_tax_query = false; $tax_query = array ( 'relation' => 'AND' , ); $category = $this ->get_attribute( 'category' ); if ( $category ) { $tax_query [] = array ( 'taxonomy' => 'course_cat' , 'field' => 'slug' , 'terms' => $category , ); $has_tax_query = true; } $hidden = $this ->get_attribute( 'hidden' ); if ( 'no' === $hidden ) { $terms = wp_list_pluck( get_terms( array ( 'taxonomy' => 'llms_product_visibility' , 'hide_empty' => false, ) ), 'term_taxonomy_id' , 'name' ); $tax_query [] = array ( 'field' => 'term_taxonomy_id' , 'operator' => 'NOT IN' , 'taxonomy' => 'llms_product_visibility' , 'terms' => array ( $terms [ 'hidden' ] ), ); $has_tax_query = true; } return $has_tax_query ? $tax_query : '' ; } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.31.0 | Changed access from private to protected. |
3.14.0 | Introduced. |