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

  • Our current solution is the following:

    
    function acf_filter_rest_api_preload_paths( $preload_paths ) {
      if ( ! get_the_ID() ) {
        return $preload_paths;
      }
      $remove_path = '/wp/v2/' . get_post_type() . 's/' . get_the_ID() . '?context=edit';
      $v1 =  array_filter(
        $preload_paths,
        function( $url ) use ( $remove_path ) {
          return $url !== $remove_path;
        }
      );
      $remove_path = '/wp/v2/' . get_post_type() . 's/' . get_the_ID() . '/autosaves?context=edit';
      return array_filter(
        $v1,
        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 );
    

    but it seems that lgladdy`s version above works as well