admin管理员组

文章数量:1130213

I'm migrating some posts from another source to WordPress, specifically to a theme/plugin called Madara, which has some specific taxonomies. I'm using wp_insert_post() to create the post, everything works fine until I try to set the taxonomies, I tried to set the taxonomies directly via the tax_input array on the wp_insert_post(), even with a post_auhtor defined and the wp_set_current_user() set, it didn't work.

I also tried with the wp_set_object_terms() after creating the post, but I've getting Invalid taxonomy error.

this is a sample screenshot taken from the "Quick Edit" request on admin panel, basically the same way I'm defining in on wp_insert_post()

Important: This is not a regular wordpress plugin, it is a cron job that's just using WordPress functions.

Wordpress files being included in the cron code:

require_once "../../../wp-load.php";
require_once "../../../wp-admin/includes/taxonomy.php";
require_once "../../../wp-admin/includes/file.php";
require_once "../../../wp-admin/includes/image.php";
require_once "../../../wp-admin/includes/media.php";

How can I add those taxonomies?

本文标签: taxonomyCannot set custom taxonomies when creating post