Tags are just for posts but Glossary terms are another post type and we offer a glossary taxonomy for that.
If you want to add support for tags also on glossary terms you need this php snippet:
add_action( ‘init’, ‘register_taxonomy_for_object_type’ );
function register_taxonomy_for_object_type() {
register_taxonomy_for_object_type( ‘post_tag’, ‘glossary’ );
};
Great! And where do I put this php snippet?
Thanks a lot for the help.
In the functions.php file of your theme.
Snippet has not been activated due to an error.
Error message:
Cannot redeclare register_taxonomy_for_object_type() (previously declared in /home1/sonho152/special-offer-hub.com/wp-includes/taxonomy.php:722)
What can be wrong?
I added using WP code snippets plugin
Thank you.
Sorry my fault, this one should fix the issue:
add_action( ‘init’, ‘glossary_register_taxonomy_for_object_type’ );
function glossary_register_taxonomy_for_object_type() {
register_taxonomy_for_object_type( ‘post_tag’, ‘glossary’ );
};
I’m embarrassed, but it still didn’t work out…
Now the following error appears:
We encountered an error activating your snippet, please check the syntax and try again. Error message: Undefined constant ‘init’
Im sorry!
I asked ChatGPT. This should work (works for me at least):
add_action('init', 'glossary_register_taxonomy_for_object_type'); function glossary_register_taxonomy_for_object_type() { register_taxonomy_for_object_type('post_tag', 'glossary'); }
Yes, sorry I copy/pasted a snippet and changed some things but I didn’t noticed that it was using the OSX apix.
This one fix the issues:
add_action( 'init', 'glossary_register_taxonomy_for_object_type' );
function glossary_register_taxonomy_for_object_type() {
register_taxonomy_for_object_type( 'post_tag', 'glossary' );
}
Is it possible to use the tags in your shortcodes?
Like this if I want to show only entries of the tag “SEO”:
[glossary-terms order=”desc” num=”3″ tag=”seo”]
-
This reply was modified 2 years, 9 months ago by
Joehann.
No, our code support only the native glossary-cat taxonomy and not others.
If you want to do that, you need to copy and change the php code to create a new shortcode.
Check our documentation https://docs.codeat.co/glossary/shortcodes/#list-of-terms