Support

Account

Home Forums Front-end Issues Can't get ACF fields after creating a new page Reply To: Can't get ACF fields after creating a new page

  • Hi @elliot,

    thank you for your answer.
    We use a OO-Form to create our new WP-page. After we create this page we use the following function to save the values:

    public function updateFields($cover_pic_id) {
            // update all custom fields in the projects page
            update_field('project_name', $_POST[PNAME], $this->post_id);
            update_field('short_description', $_POST[SHORTDESC], $this->post_id);
            update_field('overview_text', $_POST[OVERVIEW], $this->post_id);
            update_field('equity_text', $_POST[EQUITY], $this->post_id);
            update_field('start_date', $_POST[STARTDATE], $this->post_id);
            update_field('end_date', $_POST[ENDDATE], $this->post_id);
            update_field('investment_goal', $_POST[INVGOAL], $this->post_id);
            update_field('keywords', $_POST[KEYWORDS], $this->post_id);
            update_field('cover_pic', $cover_pic_id, $this->post_id);
        }

    ($this->post_id is a private member variable that saves the post-id of the page just created)

    So all in short on submitting:

    $this->createNewProject();
    $this->updateFields($cover_pic_id);  // update custom fields in project

    maybe we do have to update the fields before we create the page? but that would not be logical?

    As mentionned the values are visible in the backend, but we cannot access them with get_field() before saving the page manually.
    Thanks Julson