PHP code example of viget / viget-primary-term
1. Go to this page and download the library: Download viget/viget-primary-term library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
viget / viget-primary-term example snippets
add_filter(
'vgpt_registered_taxonomies',
function ( array $taxonomies ): array {
$taxonomies[] = 'product_category';
return $taxonomies;
}
);
$term = vgpt()->get_primary_term( $post_id, 'product_category' );