When I install the plugin, I want to create 10 CPTs of a particular type, which I define in the init
action hook, and want to assign 10 terms of a custom taxonomy, which too is defined in an init
callback. I tried doing it on register_activation_hook
, but the CPT's terms are not set. Is there a way to achieve this?
When I install the plugin, I want to create 10 CPTs of a particular type, which I define in the init
action hook, and want to assign 10 terms of a custom taxonomy, which too is defined in an init
callback. I tried doing it on register_activation_hook
, but the CPT's terms are not set. Is there a way to achieve this?
1 Answer
Reset to default 0According to the docs, I needed to set the terms using post ID. So after every insert, I used the ID to set the terms https://codex.wordpress/Function_Reference/wp_set_post_terms
Someone might find this useful.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745365780a4624572.html
评论列表(0条)