Wordpress categories taxonomy
I`m using ACF plugin for custom fields and categories made from the plugin. My problem is that I made a custom category called "Mobile". Adding a new custom post and inserting it in the category "Mobile" from admin dashboard works.
But if i`m trying to to set the post to that category from code with wp_set_object_terms it gives me an error with invalid taxonomy. I have looked for a solution to my situation but the only thing that is important that the taxonomy to be loaded before i call it. I don`t know where to look in the ACF plugin or my plugin to see what`s wrong.
Can you give me an advice? Thank you.
I think the problem is in the usage of wp_set_object_terms() function. The second parameter should contain the id or slug of the term to add, in your case, it should be the slug or the id related to 'mobile_cat'. Then the third parameter should specify the taxonomy where to add this term. In your post still don't know what is your taxonomy name.
You can get all the required info from database.