Support

Account

Home Forums Backend Issues (wp-admin) Update to WP 5.9.1 breaks media selection Reply To: Update to WP 5.9.1 breaks media selection

  • Just an quick update, this issue will work – but as @dominik_fuchshofer suggested, if there is a current autosave it will still be broken.

    We’ll need to do some more internal code changes to handle autosaves – but disabling them as Dominik’s code should solve the issue for now, while we can get the release ready.

    Could you try the following code, and see if you have any issues?

    function acf_filter_rest_api_preload_paths( $preload_paths ) {
    	global $post;
    	$rest_path    = rest_get_route_for_post( $post );
    	$remove_paths = array(
    		add_query_arg( 'context', 'edit', $rest_path ),
    		sprintf( '%s/autosaves?context=edit', $rest_path ),
    	);
    
    	return array_filter(
    		$preload_paths,
    		function( $url ) use ( $remove_paths ) {
    			return ! in_array( $url, $remove_paths, true );
    		}
    	);
    }
    add_filter( 'block_editor_rest_api_preload_paths', 'acf_filter_rest_api_preload_paths', 10, 1 );