Support

Account

Home Forums Backend Issues (wp-admin) acf-json files not being created Reply To: acf-json files not being created

  • I’m stumped as well. Not knowing what could cause this I would start outputting debugging information by following the code in ACF and and making changes.

    For example the ftil /includes/local-json.php line ~205 the function save_json, the following are some of the things I would do. Please note that only one of these would work at a time and would prevent the saving.

    
    public function save_file( $key, $field_group ) {
    		$path = acf_get_setting( 'save_json' );
    
    // see what the path is
    echo $path; die;
    		$file = untrailingslashit( $path ) . '/' . $key . '.json';
    		if( !is_writable($path) ) {
    // folder not writable
    echo 'path is not writable'; die;
    			return false;
    		}
    		
    		// Append modified time.
    		if( $field_group['ID'] ) {
    			$field_group['modified'] = get_post_modified_time( 'U', true, $field_group['ID'] );
    		} else {
    			$field_group['modified'] = strtotime();
    		}
    		
    		// Prepare for export.
    		$field_group = acf_prepare_field_group_for_export( $field_group );
    
    // see what the field group looks like
    echo '<pre>'; print_r($field_group); die;
    		
    		// Save and return true if bytes were written.
    		$result = file_put_contents( $file, acf_json_encode( $field_group ) );
    
    // see what is returned by file_put_contents()
    echo '<pre>'; var_dump($result); die;
    		return is_int( $result );
    	}
    

    Depending on my debugging here I would move to either on to other functions, either those called by this function or I’d look for where this function is called.