__get_terms
A utility method that retrieves a collection of terms in a given taxonomy.
REMINDER
The __get_terms() is a public static method of Handy class. When using this static method, remember to apply the Scope Resolution Operator (::).
Parameters
| Name | Description |
|---|---|
| $taxonomy |
The name of taxonomy to which results should be limited. |
Basic Usage
REMINDER
In this example, the select control's choices parameter will be supplied with __get_terms().
// Select Control.
Handy::control( 'select', [
'id' => 'select_id',
'section' => 'layout_section',
'label' => esc_html__( 'Select Control', 'textdomain' ),
'priority' => 1,
'choices' => Handy::__get_terms( 'category' )
]);
Return
| Type | Value |
|---|---|
| array | [ 'term_id' => 'term_name', … ] |