Forum Replies Created

  • After a discussion with @johannesalfanova-dk and after checking its website, the problem came from the get_field() that was used in the acf/init hook before the local field group PHP registration. So ACF 5.11.1 wasn’t able to retrieve the field and the value.

    Changing the hooks priority fixed the issue (registration first and then the get_field() call).


  • Hello,

    Thanks for the details and info, it’s now a little more clear.

    One question, do you use have_archive(): the_archive() loop from ACF Extended on your Post Type Archive template? If so, do you have any posts of that post type displayed there?

    Just to check something, can you please try to echo get_field('udstiller_label_ental', 'produkt_archive') on a page outside of the Post Type Archive? For example on the Homepage?

    I’ll be waiting for you to setup that Test Install. We’ll get a better view of the data with the Developer Mode screenshot on your Archive Page.


  • Okay. Can you please enable the Developer Mode using the following code:

    add_action('acfe/init', 'my_acfe_modules');
    function my_acfe_modules(){
        // Enable Developer Mode
        acfe_update_setting('dev', true);

    Then visit your Archive Page in the Admin UI. You should now see the ACF Options Meta overview which will display all fields and their values just like they are saved in the database (like in my previous screenshot).

    Your field should be there produkt_archive_felt. Can you please share a screenshot of it?

    Note: To make sure everything is alright, we should discuss and use code with plain text only, without variables (as I don’t really know what is behind those variables).

    So my guess is that you tested: echo get_field('felt', 'produkt_archive');.

    The Developer Mode will confirm if that field exists.


  • Hello @johannesalfanova-dk,

    ACF Extended developer here. I ran some tests on my side with ACF 5.11, and everything looks alright. See test screenshot:

    The code used is get_field('my_field', 'my-post-type_archive').

    Can you please share the code you’re using that doesn’t work on your side? Please note that it is important to use {post-type-name}_archive as Post ID. For example: entries_archive or events_archive.

    Also, can you try to retrieve the field like I did, using plain text code (and not with variables like $posttype), to check if it works?

    You can enable the Developer Mode to get more details about the Archive Page, its ID and the fields metadata like I did on my screenshot.

    Note: ACF Extended doesn’t touch the get_field() function. The Archive Page is just a glorified ACF Options Page, that is automatically placed under the related Post Type menu.

    Hope it helps!


  • Hello!

    Sorry for the late answer! In fact, if you use the argument 'uploader' => 'basic' in your acf_form call to use the native browser upload button, then it won’t be properly uploaded by the form.

    For you information, 'uploader' => 'wp' (the WP upload popup) works, but I don’t want to show it on front forms. So I decided to re-work my code in order to make it fully compatible with the native browser uploader.

    Here is the Javascript:

    I decided to rewrite the function acf.validation.fetch to use formdata instead of classic ACF Form ajax calls. Note that I remove the data.action = 'acf/validate_save_post' argument, because I’ll add my own Ajax action for each one of my ACF Forms.

    Here is the PHP:

    Using the action acf/input/form_data, I’ll add my own <input type="hidden" name="action" value="hwk_ajax_acf_register_ajax_submit" />. Now the data.action is set, the Javascript call will understand what Ajax action I want to reach.

    Then, I define my own PHP Ajax fonctions:

    add_action('wp_ajax_hwk_ajax_acf_register_ajax_submit', 'hwk_ajax_acf_register_ajax_submit');
    add_action('wp_ajax_nopriv_hwk_ajax_acf_register_ajax_submit', 'hwk_ajax_acf_register_ajax_submit');
    • Checking the nonce with acf_verify_nonce(‘acf_form’)
    • Validating data with acf_validate_save_post() (which call the action acf/validate_save_post)
    • And finally, process my data…

    I hope everything is clear. I also updated my article, so the login/register/lost password & account forms use the same method.

    Let me know if you need some more explanations 🙂

  • Hello,

    As far as I know, there’s no way to actually do it “out-of-the-box”. There’s a workaround tho. Within each one of your layouts, add one “clone” field, which will clone an entire field group. The targeted field group will be used as a “template”.

    Then, you can easily add custom settings to your “template” field groups, using the action acf/render_field_group_settings coupled with acf_render_field_wrap() function.

    You now have field groups which are actual Flexible Content layouts, with custom settings (Image upload, Google map etc…). Just remember to deactive them, so they won’t appear on regular post types out of the flexible content 😉

    If you’re interested, I have a list of all fields which can be used as field group settings and their behavior. Just let me know if you want it!

  • Hello,

    I know the topic is kind of old, but I decided to dig in and found the following solution:

    add_action('acf/input/admin_footer', 'hwk_flexible_content_layout_no_popup');
    function hwk_flexible_content_layout_no_popup() {
        <script type="text/javascript">
            // ACF Flexible Content: Directly add layout if there's only one layout
            var flexible_content_open = acf.fields.flexible_content._open;
            acf.fields.flexible_content._open = function(e){
                var $popup = $(this.$el.children('.tmpl-popup').html());
                // Count layouts
                if($popup.find('a').length == 1){
                    return false;
                // More than one layout? Continue the JS execution
                return flexible_content_open.apply(this, arguments);

    Hope it helps 🙂

  • Hey everyone,

    There’s actually a way to use one and single ajax request during a acf_form() front-end posting.

    You can take advantage of the acf/validate_save_post hook which is fired at the beginning of the acf_form() ajax validation request.

    You just have to trigger acf_get_validation_errors() with a wp_send_json_success return in order to keep the inherent ACF Form validation (required field, minimum/maximum etc…). Then, you must use new acf_form_front() to process the form in your ajax request, just like ACF Form does when it reloads the page after validation.

    Here is an exemple of the hook usage:

    add_action('acf/validate_save_post', 'hwk_ajax_acf_form_hook');
    function hwk_ajax_acf_form_hook(){
        if(!wp_doing_ajax() || !isset($_POST['_acf_post_id']) || !acf_verify_nonce('acf_form'))
        // Native ACF Form validation (required, minimum/maximum etc...)
        if($errors = acf_get_validation_errors())
                'valid' 	=> 0,
                'errors' 	=> $errors,
        // acf_form() arguments are stocked in $_POST['_acf_form']
        if(!$form = $_POST['_acf_form'])
        // Decoding the form arguments via acf_decrypt().
        $form = json_decode(acf_decrypt($form), true);
        // Creating a 'proxy form' for the Legacy ACF Form fields saving
        // Setting 'return' to null to avoid built-in redirection
        $proxy = $form;
        $proxy['return'] = '';
        // Using native ACF Form submission method
        acf()->form_front = new acf_form_front();
            'valid' => 1,
            'data' 	=> 'Success!',

    The javascript part use the acf.add_filter('validation_complete') filter. Remember to add preventDefault() on form submission to avoid the legacy acf_form() page reload.

    $('.acf-form.acf-form-ajax').on('submit', function(e){

    If you’re interested about the whole process, I’ve written a full tutorial, including the creation of a Login, Register, Lost password & My Account forms with ACF Form, 100% in Ajax:

    It’s written in french, but the code is english-friendly 😉

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