LLMS_Post_Model::get_terms( string $tax, boolean $single = false )
Get an array of terms for a given taxonomy for the post
Description Description
Parameters Parameters
- $tax
-
(string) (Required) taxonomy name
- $single
-
(boolean) (Optional) return only one term as an int, useful for taxes which can only have one term (eg: visibilities and difficulties and such)
Default value: false
Return Return
(mixed) when single a single term object or null when not single an array of term objects
Source Source
File: includes/abstracts/abstract.llms.post.model.php
public function get_terms( $tax, $single = false ) { $terms = get_the_terms( $this->get( 'id' ), $tax ); if ( $single ) { return $terms ? $terms[0] : null; } return $terms ? $terms : array(); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.8.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: