钩子文档

block_editor_no_javascript_message

💡 云策文档标注

概述

此文档介绍 WordPress 中的 block_editor_no_javascript_message 过滤器,用于自定义块编辑器在浏览器未启用 JavaScript 时显示的消息。开发者可以通过此过滤器修改消息内容、基于当前文章或经典编辑器安装状态进行调整。

关键要点

  • block_editor_no_javascript_message 是一个过滤器,允许开发者修改块编辑器在无 JavaScript 环境下的提示消息。
  • 过滤器接收三个参数:$message(当前显示的消息字符串)、$post(正在编辑的文章对象 WP_Post)和 $installed(布尔值,表示经典编辑器是否已安装)。
  • 此过滤器在 WordPress 5.0.3 版本引入,并在 6.4.0 版本新增了 $installed 参数。

代码示例

$message = apply_filters( 'block_editor_no_javascript_message', $message, $post, $installed );

📄 原文内容

Filters the message displayed in the block editor interface when JavaScript is not enabled in the browser.

Parameters

$messagestring
The message being displayed.
$postWP_Post
The post being edited.
$installedbool
Whether the classic editor is installed.

Source

$message = apply_filters( 'block_editor_no_javascript_message', $message, $post, $installed );

Changelog

Version Description
6.4.0 Added $installed parameter.
5.0.3 Introduced.