How to Get 'qqcpat' Taxonomies of a WordPress Post on a Single Page
To retrieve the "qqcpat" taxonomies of a post in WordPress on a single page, you can use the get_the_terms() function. Here's an example code snippet:
\
<?php\
// Get the current post ID\
$post_id = get_the_ID();\
\
// Retrieve the 'qqcpat' taxonomies for the post\
$terms = get_the_terms($post_id, 'qqcpat');\
\
if ($terms && !is_wp_error($terms)) {\
foreach ($terms as $term) {\
echo '<a href="' . get_term_link($term) . '">' . $term->name . '</a>';\
}\
}\
?>\
```\
\
Make sure to replace `'qqcpat'` with the actual taxonomy slug you want to retrieve. You can place this code snippet in your single page template file, such as `single.php`, to display the taxonomies for each post.
原文地址: https://www.cveoy.top/t/topic/qbWP 著作权归作者所有。请勿转载和采集!