Skip Navigation

[Resolved] Unable to fetch custom taxonomy

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Luo Yang 6 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#917734

Tell us what you are trying to do? I have created and store custom taxonomy "event" which is associated with custom post types and term fields too. But when I try to fetch this custom taxonomy using `get_taxonomy('event')` it says invalid taxonomy.

I have tried get_terms, get_term_object etc.
I am not sure why this is happening, but I will appreciate if you can guide me through this.

hidden link
Username: Admin
Password: 4jUnDxl9H38m4O7L8sHu#^FS
You can do testing in the functions.php file of the currently active theme.
I'll appreciate if you can reply me back at "sohaib@woof.com.au"

#917746

Hello,

I have tried the credentials you provided above, it is not valid, I get this error message:
ERROR: The password you entered for the username Admin is incorrect

Is the taxonomy "event" created with Types plugin? if it is, please make sure the taxonomy is using slug "event", I have tested your codes get_taxonomy('event') in my localhost, it works fine

If you are going to retrieve the terms assigned to a specific post, you will need to try another wordpress function wp_get_object_terms()
https://developer.wordpress.org/reference/functions/wp_get_object_terms/
Retrieves the terms associated with the given object(s), in the supplied taxonomies.

#918144
toolset-2.png
toolset-1.png

Yes, I am using ToolSet to create taxonomy and taxonomy is using slug "event". I have attached the two screengrabs for you.
Plus, I just updated the password, please use the following details to log in.

link: hidden link
Username: admin
Password: *****

#918148

Plus,

 get_taxonomies(); 

just only returns the WordPress default taxonomies but not "event".

#918153

I have tried these in your website:
1) Edit the theme file functions.php, add some PHP codes to create a custom shortcode:

add_shortcode('event_tax', 'event_tax_func');
function event_tax_func($atts, $content){
	$tax = get_taxonomy('event');
	var_dump($tax);
}

2) Create a wordpress page to display above shortcode:
hidden link
It does output the settings of taxonomy "event", the taxonomy "event" works fine in your website

More help:
https://developer.wordpress.org/reference/functions/add_shortcode/