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.

Answers


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.

good luck


Need Your Help

Comparing a dictionary of values to a list of values

python image python-imaging-library

I'm currently trying to compare a list of pixel R/G/B values that I'm obtaining from an image, to predefined dictionary of RGB values. My question is, what would be the most pythonic (and easiest) ...

Unable to set SKView backgroundColor

ios objective-c ios7 sprite-kit skview

I have an issue where my SKView's background color (grey) is briefly being displayed before the scene is presented.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.