wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_get_link_cats › WordPress Function

Since2.1.0
已弃用n/a
› wp_get_link_cats ( $link_id = 0 )
参数:
  • (int) $link_id Link ID to look up.
    Required: No
    默认: —
返回:
  • (int[]|WP_Error) The IDs of the requested link's categories, or else a WP_Error if the `link_category` taxonomy was unregistered.
定义在:
文档:

Retrieves the link category IDs associated with the link specified.



源码

function wp_get_link_cats( $link_id = 0 ) {
	$cats = wp_get_object_terms( $link_id, 'link_category', array( 'fields' => 'ids' ) );
	if ( is_wp_error( $cats ) ) {
		return $cats;
	}
	return array_unique( $cats );
}