Support

Account

Forum Replies Created

  • This question ranks highly in the search engine, so I would like to share a method how resolve field groups being stuck on “Awaiting Save”.

    1. From Field Groups > Tools, export all field groups as JSON to my Downloads folder.
    2. Trash all field groups. I also deleted all field groups permanently, but this may be unnecessary.
    3. Delete all stray JSON in the /acf-json folder.
    4. Import the JSON file.

    How I think it happened
    At first, I told ACF to save JSON to a theme subfolder: get_stylesheet_directory() . /acf-json. Next, I added two new field groups and saved them. However, later on I changed my mind, and added a second, conflicting PHP file, which told ACF to save local JSON to /mu-plugins/acf-json. However, I forgot to create the /mu-plugins/acf-json folder, which meant I was telling ACF to write JSON somewhere non-writable: a directory which didn’t exist.

    A couple weeks pass before I get to work this project again. I had not though much about the local JSON, until I was ready to commit the finished field group. However, I noticed that updates to the field groups were no longer showing in the version control panel in Visual Studio Code. After digging around in the theme and the mu-plugins folder, I deleted the second, conflicting PHP file. Nevertheless, even after removing the reference to the non-existent folder, ACF was not able to save local JSON to the theme. All field groups, even brand-new ones, were stuck at “Awaiting Save”. It seemed like the only way to save the field groups would be to start over: export to JSON, delete all, then import from JSON.

  • Commenting to remind others like myself: don’t forget to set ‘jquery’ as the dependency when enqueueing John’s script. Otherwise, you might receive “Uncaught TypeError: url.indexOf is not a function”.

    
    add_action( 'wp_enqueue_scripts', function() {
        wp_enqueue_script('load-deferred-videos-js', get_template_directory_uri() . '/static/js/load-deferred-videos.js', ['jquery']);
    });
    

    Notice ['jquery'] as the third argument to wp_enqueue_script.

    P.S.
    If you only want to load this script on a custom post type, such as “car”, then wrap the wp_enqueue_script function inside an if-clause.

    
    if (is_singular('car')) {
            wp_enqueue_script('load-deferred-videos-js', get_template_directory_uri() . '/static/js/load-deferred-videos.js', ['jquery']);
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)