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
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. |