php – Custom CPT – Programmatically create categories to assign CPT when a new one is created
Question
I’m creating a CPT using this code in my OOP plugin
register_post_type(
'products',
[
'label' => __('Products', ''),
'description' => __('', ''),
'show_in_rest' => true,
'rest_namespace' => $this->namespace,
'public' => true,
'supports' => [
'title',
'editor',
'revisions',
'thumbnail'
],
'show_ui' => true,
'show_in_menu' => true,
'menu_icon' => 'dashicons-store',
'register_meta_box_cb' => [$this, 'register_product_metabox']
]
);
I want to create some categories using the plugin, so I can assign the CPT to a category when a new one is created. How I can achive this?
0
2 weeks
2023-03-07T09:39:20-05:00
2023-03-07T09:39:20-05:00 0 Answers
0 views
0
Leave an answer