Hi @laymonk
Extremely sorry for this problem. We will check and try to give you the solution.
Thank you
Thanks a million for responding … Hoping for a solution asap.
Hello,
ACF Extended developer here. After some investigations, it looks like Document Embedder hijack the global $post object during ajax requests (and probably during other situations too).
Also note that this problem occurs without ACF Extended (only with ACF). Here are the instructions to reproduce the problem:
– Install WordPress + Blank Theme
– Install ACF + Document Embedder
– Create a new “Test Document” in Document Embedder
– Create an ACF Field Group with one simple Text field called my_text
– Set the field as “Required”
– Set the Field Group to be displayed on the post type “Page”
– Add the following code in the functions.php file:
add_action('acf/validate_value/name=my_text', 'my_acf_validate_field', 10, 4);
function my_acf_validate_field($valid, $value, $field, $input_name){
acf_log(get_post());
acf_log(get_the_ID());
// You can also use print_r() instead of acf_log()
return $valid;
}
– Create a new Page, the “my_text” field will be displayed
– Leave the field empty and save the page. A validation error will be shown
– Check logs, get_post() get_the_ID() will return the “Test Document” from Document Embedder (when it should return nothing).
This weird behavior makes me think that Document Embedder hijack the $post in others situations too which is probably the root of the problem.
Hope it helps!
Regards.
Thanks for chipping in your feedback here, Konrad.
Hopefully, that provides enough insight to help isolate the issues …