“wp_insert_post_data” filter works great on Quick Edit. I get taxonomies from the $_POST and set the post status in the filter. But when I am on the full edit page I have no access to taxonomies as $_POST contains now different data than $_POST from Quick Edit inside the filter. Is that normal? How can I access taxonomies on edit post inside that filer?
function filter_handler( $data , $postarr ) {
$temp = array();
$taxonomies = json_encode($_POST['tax_input']);
$tax_arr = json_decode($taxonomies,true);
foreach ($tax_arr as $key => $val){
if(count($val) <= 1){
array_push($temp, $val);
}
}
if(count($temp) > 0 ){
$data['post_status'] = 'draft';
}
else {
$data['post_status'] = 'publish';
}
return $data;
}