Load a certain functions file for a certain taxonomy

I think there’s three things going on with your code. The first is that you’re passing a numeric string as the first parameter to has_term(). If you’re trying to pass the term ID to the function, you should remove the quotes from ’16’ and just pass 16, i.e. as integer. https://developer.wordpress.org/reference/functions/has_term/ The second is that … Read more

Get taxonomy singular name instead of taxonomy slug inside $taxonomy query

get_object_taxonomies() by default returns a list of taxonomy names like category and post_tag. If you want the function to return taxonomy objects instead, then set the second parameter to objects: $taxonomies = get_object_taxonomies($custom_post_type_name, ‘objects’); And then change your foreach () code to foreach ($taxonomies as $taxonomy => $tax_object), then use $tax_object->labels->singular_name to access the singular … Read more

Permalink problems with custom post type and custom taxonomy

There was a problem with archive page and pagination in the original answer. Therefore, instead of changing the “rewrite” => [‘slug’ => ‘our-training/%training-category%’] in register_post_type() as I suggested earlier, add the following rewrite rules and change the links created for CPT. The rules will handle such addresses: display single training post with pagination support /our-training/training-category-1/training-name/ … Read more

Multiple Custom Taxonomy Dropdowns Lists

The “dropdown” element declared and used in each of these functions is the same, so the last one is overriding all previous. Specifying different terms each time fixes the problem: var writerdropdown = document.getElementById(“writers”); function onWriterChange() { if ( writerdropdown.options[writerdropdown.selectedIndex].value != -1 ) { location.href = “<?php echo home_url();?>/writer/”+writerdropdown.options[writerdropdown.selectedIndex].value+”/”; } } writerdropdown.onchange = onWriterChange; var … Read more