WPSEO_Replace_Vars::retrieve_ct_custom_tax_name()
Retrieve a post/page/cpt's custom taxonomies for use as replacement string.
Метод класса: WPSEO_Replace_Vars{}
Хуков нет.
Возвращает
Строку|null
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->retrieve_ct_custom_tax_name( $var_to_replace, $single );
- $var_to_replace(строка) (обязательный)
- The complete variable to replace which includes the name of the custom taxonomy which value(s) is to be retrieved.
- $single(true|false)
- Whether to retrieve only the first or all values for the taxonomy.
По умолчанию: false
Код WPSEO_Replace_Vars::retrieve_ct_custom_tax_name() WPSEO Replace Vars::retrieve ct custom tax name Yoast 24.9
private function retrieve_ct_custom_tax_name( $var_to_replace, $single = false ) { $replacement = null; if ( ( is_string( $var_to_replace ) && $var_to_replace !== '' ) && ! empty( $this->args->ID ) ) { $tax = substr( $var_to_replace, 3 ); $name = $this->get_terms( $this->args->ID, $tax, $single ); if ( $name !== '' ) { $replacement = $name; } } return $replacement; }