How to set category correctly for a custom post created by a remote API call?
Functions like get_cat_ID and get_category_by_slug only work for core post categories (taxonomy category) – you are dealing with a custom taxonomy todocategories. I see you have $a2zq3_cat_name=”Category-name”; hardcoded near the top, so I assume you’re not assigning the todocategories from POST data. In which case just use wp_set_object_terms() like so. wp_set_object_terms( $a2z3_entry_post_id, [ ‘the-category-slug’ ], … Read more