Home Forums Front-end Issues No $ _POST variable available after submitting a form


No $ _POST variable available after submitting a form

  • Hi

    I have a question about the acf_form () function. Problem is: I create a normal page in the backend of my CPT and insert my shortcode here that contains the acf_form (). Now I would like to have the $ _POST variable output after submitting the form. On any other post_type, however, it does not work for my own CPT.
    I get an empty array () back here.
    What could be the reasons?

    if (isset($_POST)) {
    	echo '<pre>';
    	echo '</pre>';
    $options = array(
    	'post_id'	         => 'new_post',
    	'field_groups'		 => array( 25 ),
    acf_form( $options );
  • $_POST is not set when you are displaying an admin page.

    When you submit a post the post is processed, nothing is displayed, once the processing is done you are redirected back to the edit page, $_POST is not included.

  • Hey John,

    Thanks for your answer. I have just solved the problem. Apparently acf_form_head () causes that I cannot access the $ _POST variable because it is completely deleted once during the redirect. Thank you for answering anyway. Maybe some didn’t know that?

    P.S: In addition, I am not creating an admin page, but a normal field_group with the ID.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.