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

  • @thorben Nice catch, I forgot about context. I’ll look up the code WordPress uses to add that URL and clone that, custom post types will be different too.

    function acf_filter_rest_api_preload_paths( $preload_paths ) {
    	global $post;
    	$rest_path   = rest_get_route_for_post( $post );
    	$remove_path = add_query_arg( 'context', 'edit', $rest_path );
    
    	return array_filter(
    		$preload_paths,
    		function( $url ) use ( $remove_path ) {
    			return $url !== $remove_path;
    		}
    	);
    }
    add_filter( 'block_editor_rest_api_preload_paths', 'acf_filter_rest_api_preload_paths', 10, 1 );

    That said, if this still isn’t working for you – don’t worry – we’re still actively working on the issue to see if there are cases where this isn’t working.