WordPress-选择页面特色图像时媒体库样式无法正确加载?

发布于 2025-01-09 23:37:04 字数 642 浏览 1 评论 0原文

我正在尝试使用块编辑器将特色图像设置到某些页面,

因此当我按下选择特色图像时,媒体库的上传 UI 未正确加载其自己的样式表(但获取图像并搜索工作正常)

该问题仅出现在某些页面上(具有相同的模板!!!)

例如:我有 2 个具有相同默认模板的页面。

  1. 关于我们页面(存在问题)。
  2. 员工页面(选择精选图片时完全没有问题

这是以下的屏幕截图问题

我尝试过的:

  1. 检查了每个插件的停用和激活(没有更改)
  2. 添加 define( 'CONCATENATE_SCRIPTS', false );wp-config.php 文件中(没有更改)
  3. 检查控制台没有错误。
  4. 2 个不同设备上的不同浏览器(没有变化)

WP 版本:5.9.1

任何想法将不胜感激,谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌若浮生 2025-01-16 23:37:04

经过一番搜索,问题出在包含 ACF 块的页面中

ACF 插件与最新的 WP 5.9.1 临时修复不兼容,

直到更新发布为止:

1- 在您的 functions.php 文件中添加这些行:

 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 );


回滚到之前的 WordPress 版本,例如 5.9

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文