'$_POST is empty on saved_post hook
I'm developing a Wordpress website using astra-child and having issue in getting Form Data. I'm trying to get my custom field in saved_post hook but the $_POST is empty and the fields in the metadata are always the previous.
I`m using acf plugin and tried the hook 'acf/saved_post' which is not even triggering. also tried some other wp hooks like publish_post , rest_after_insert_post
The action in functions.php
add_action("save_post", "on_saved_post", 999999);
function on_saved_post($post_id)
{
$json_string_data = file_get_contents('php://input');
$decoded_data = json_decode($json_string_data, true);
write_log("json " . print_r($decoded_data, true));
write_log("post " . print_r($_POST, true));
write_log("get" . print_r($_GET, true));
write_log("req" . print_r($_REQUEST, true));
}
My Output
json Array
(
[id] => 9004111222328892
[content] =>
)
post Array
(
)
getArray
(
[_locale] => user
)
reqArray
(
[_locale] => user
)
Any ideas?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
