Hello
I have a custom taxonomy called content_type where by (Sponsored Posts) is a taxonomy option, now ive hidden/excluded this (Sponsored Posts) taxonomy option in the buddyblog settings but im using this code below to auto assign the (Sponsored Posts) taxonomy when a post has been paid for on checkout.
/** * Assign (Sponsored Post) category to BuddyBlog pay per post articles on checkout. */ add_action( 'bblpro_ppp_post_purchase_completed', function( $post_id ) { $post_type = get_post_type( $post_id ); if ( 'post' !== $post_type ) { return; } // Get taxonomy term. $newterm = get_term_by( 'name', 'Sponsored Posts', 'content_type' ); if ( ! $newterm ) { return; } // Assign term to post. wp_set_post_terms( $post_id, $newterm->term_id, 'content_type', true ); } );
The problem now is if I try to edit and update the published post later, the previously assigned (Sponsored Posts) taxonomy is removed after clicking the update button
How can I enable the previous assigned paid post to still remain intact when editing the post even though the taxonomy is hidden
Hi Tosin,
I am sorry but I do not understand this partI have a custom taxonomy called content_type where by (Sponsored Posts) is a taxonomy option, now ive hidden/excluded this (Sponsored Posts) taxonomy option in the buddyblog settings but im using this code below to auto assign the (Sponsored Posts) taxonomy when a post has been paid for on checkout.
Please help me understand it clearly(which post type, terms, taxonomies are relevant, are you attaching multiple taxonomy terms with the post?)
Thank you
Brajesh
You must be logged in to reply to this topic.