首页 WordPress函数大全 get_objects_in_term()

get_objects_in_term()

2020-05-01 / 3272阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

get_objects_in_term( int|array $term_ids, string|array $taxonomies, array|string $args = array() )

Retrieve object_ids of valid taxonomy and term.

描述

The strings of $taxonomies must exist before this function will continue.>WP_Error class, kind of like Exceptions in PHP 5, except you can’t catch them. Even so, you can still test for the WP_Error class and get the error message.

The $terms aren’t checked the same as $taxonomies, but still need to exist for $object_ids to be returned.

It is possible to change the order that object_ids is returned by either using PHP sort family functions or using the database by using $args with either ASC or DESC array. The value should be in the key named ‘order’.

参数

$term_ids

(int|array)
(Required)
Term id or array of term ids of terms that will be used.

$taxonomies

(string|array)
(Required)
String of taxonomy name or Array of string values of taxonomy names.

$args

(array|string)
(Optional)
Change the order of the object_ids, either ASC or DESC.

Default value: array()

返回

(WP_Error|array) If the taxonomy does not exist, then WP_Error will be returned. On success. the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.

大家谈论
    我的见解