I am using the filter “wp_insert_post_data” to decide what to save to the database. I need to know which category has been picked before saving the post.
How can I get to know the category that has been picked while using that filter? Is there a $_POST[“category”] like variable or category object accessible at this phase?
Yes, and you’re quite close to it. Just use the
$postarr
parameter of this filter: