我试图在WP Job Manager中的单个帖子(作业列表)中显示作业类别。
我尝试了下面的代码,但它显示“Array”。
function get_the_job_category( $id = false ) {
$categories = get_the_terms( $id, \'job_category\' );
if ( ! $categories || is_wp_error( $categories ) )
$categories = array();
$categories = array_values( $categories );
foreach ( array_keys( $categories ) as $key ) {
_make_cat_compat( $categories[$key] );
}
/**
* Filters the array of categories to return for a post.
*
* @since 3.1.0
* @since 4.4.0 Added `$id` parameter.
*
* @param array $categories An array of categories to return for the post.
* @param int $id ID of the post.
*/
return apply_filters( \'get_the_job_categories\', $categories, $id );
}
如何显示当前职务类别名称?