get_object_terms хук-фильтрWP 4.2.0

Filters the terms for a given object or objects.

Использование

add_filter( 'get_object_terms', 'wp_kama_get_object_terms_filter', 10, 4 );

/**
 * Function for `get_object_terms` filter-hook.
 * 
 * @param WP_Term[]|int[]|string[]|string $terms      Array of terms or a count thereof as a numeric string.
 * @param int[]                           $object_ids Array of object IDs for which terms were retrieved.
 * @param string[]                        $taxonomies Array of taxonomy names from which terms were retrieved.
 * @param array                           $args       Array of arguments for retrieving terms for the given object(s). See wp_get_object_terms() for details.
 *
 * @return WP_Term[]|int[]|string[]|string
 */
function wp_kama_get_object_terms_filter( $terms, $object_ids, $taxonomies, $args ){

	// filter...
	return $terms;
}
$terms(WP_Term[]|int[]|string[]|строка)
Array of terms or a count thereof as a numeric string.
$object_ids(int[])
Array of object IDs for which terms were retrieved.
$taxonomies(string[])
Array of taxonomy names from which terms were retrieved.
$args(массив)
Array of arguments for retrieving terms for the given object(s). See wp_get_object_terms() for details.

Список изменений

С версии 4.2.0 Введена.

Где вызывается хук

wp_get_object_terms()
get_object_terms
wp-includes/taxonomy.php 2330
$terms = apply_filters( 'get_object_terms', $terms, $object_ids, $taxonomies, $args );

Где используется хук в WordPress

Использование не найдено.