To get all term IDs of a specific taxonomy for a post, you can use the wp_get_post_terms() function. Here's an example:

$taxonomy = 'your_taxonomy_slug';
$terms = wp_get_post_terms( $post_id, $taxonomy, array( 'fields' => 'ids' ) );

Replace 'your_taxonomy_slug' with the actual slug of your taxonomy, and $post_id with the ID of the post you want to retrieve the terms for.

The $terms variable will now contain an array of term IDs associated with the specified post and taxonomy

wp_set_post_terms $target_id $pcat qqcpat ;	i have mutiple terms for target_idhow can i set it $pcat is an array of numbers like 123 etcokay i see your answer thank for itnow i want to get all term i

原文地址: https://www.cveoy.top/t/topic/iBIQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录