wordpresswordpress-gutenbergmedia-library

WordPress- Media library style not loading correctly when selecting a page featured image?


I'm trying to set a featured image to some pages using block editor,

So when I press select featured images the upload UI of the media library is not loading its own stylesheet correctly ( but get images and search are working perfectly)

The problem occurs only on some pages ( with the same template!!! )

Ex: I have 2 pages with the same default template.

  1. About us page ( problem exists ).
  2. Staff page ( no problem at all when selecting featured images )

This is a screenshot of the problem

What I've tried:

  1. Checked every single plugin deactivate&activate ( no changes)
  2. Add a define( 'CONCATENATE_SCRIPTS', false ); in wp-config.php file ( no changes)
  3. Checked console there are no errors.
  4. Different browsers on 2 different devices ( no changes )

WP Version: 5.9.1

Any ideas would be appreciated, Thanks.


Solution

  • After some search, the problem was in the pages which contains ACF blocks

    ACF plugin is not compatible with the latest WP 5.9.1

    temporary fixes until the update has been released :

    1- In your functions.php file add these lines:

     function acf_fix_preload_path( $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_fix_preload_path', 10, 1 );
    

    Or rollback to the previous version of WordPress like 5.9