Support

Account

Home Forums General Issues Frontend Relationship field, not loading posts on Production.

Solved

Frontend Relationship field, not loading posts on Production.

  • I create a front end form to edit a relationship field. It works well on my local machine, and also on Wp-Engine Staging environment. But it doesn’t get any posts to choose from on Wp-Engine Production environment. It works in wp-admin, but not on front-end.

    Other acf front end forms works well on both Prod and Staging. But the relationship field won’t work on Prod, it just wont load any posts to choose from.

    Prod and Staging are both up to date, so they use exactly the same code and database.

    I asked WP-Engine if they used some kind of restriction to ajax-admin.php on Prod. But they told me that both Prod and Staging environments are the same except for caching. But they turned caching of for Prod, with no change.

    So I really don’t know what is wrong. Any idea?

    Production.
    Production, no posts to choose from.

    Staging.
    Staging, here I can choose posts.

    <?php $activity_information = array(
    'post_id' => $post->ID, // post id to get field groups from and save data to
    'field_groups' => array(341), // this will find the field groups for this post (post ID's of the acf post objects)
    'fields' => array('field_57f2163cec139'),
    'form_attributes' => array( // attributes will be added to the form element
    'class' => ''
    ),
    'return' => add_query_arg( 'updated', 'true', get_permalink() ), // return url
    'html_field_open' => '<div>', // field wrapper open
    'html_field_close' => '</div>', // field wrapper close
    'html_before_fields' => '', // html inside form before fields
    'html_after_fields' => '', // html inside form after fields
    'submit_value' => 'Spara presentation', // value for submit field
    'updated_message' => 'Presentationen uppdaterad', // default updated message. Can be false to show no message
    );
    acf_form( $activity_information ); ?>

    Wordpress 4.7.2
    ACF 5.5.5

  • How do you move the data from staging to production?

    Do you have any filters on the relationship field? for example, posts in a specific category?

  • Also, does the user type of the person make any difference? Does it work for an admin and not other users?

    1. Wp-Engine has a built in “Copy from Production to Staging” feature. It basically move the files and just migrates the database.
    2. I had filter, removed those now, no difference.
    3. Ye the form is only available if you’re logged in as admin.

    Thing is, it has worked before. I just recently noticed that it has stopped working on Production only. Problem is, I dont know when it stopped working, so dont have any idea what may have cause it.

  • I asked about the filter because if the data is migrated in some what that does not preserver the Term and Taxonomy/Term ID values then it could be that they are different on the two sites and this would cause an issue.

    I cannot reproduce this issue when testing, so I haven’t got a clue what it could be. My best suggestion at this point would be to open a new support ticket https://support.advancedcustomfields.com/new-ticket/

  • Okey this is now solved. As I suspected this was a problem with WP-Engine. Thanks to Elliot who has contacted their support in order to get an answer for this issue. Kind of weird that the support I talked to didn’t know about this, but:

    Thanks for the update! We recently made a change to one of our mu-plugins to force backend requests loaded over the WP Engine URL to load over HTTPS. This includes the /wp-admin/admin-ajax.php POST requests handling this form data. This is causing an issue with the form population on the page below, and I’ve gone ahead and disabled this functionality on our end to correct the issue.

    The support could fix this for my certain install. But at the moment there is no “global” fix.

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

The topic ‘Frontend Relationship field, not loading posts on Production.’ is closed to new replies.