钩子文档

site_editor_no_javascript_message

💡 云策文档标注

概述

本文档介绍 site_editor_no_javascript_message 过滤器,用于自定义站点编辑器在浏览器未启用 JavaScript 时显示的消息。该过滤器允许开发者修改提示信息,以提供更友好的用户体验。

关键要点

  • site_editor_no_javascript_message 是一个 WordPress 过滤器,用于修改站点编辑器在 JavaScript 未启用时显示的消息。
  • 过滤器接受两个参数:$message(当前显示的消息字符串)和 $post(正在编辑的 WP_Post 对象)。
  • 该过滤器在 WordPress 6.3.0 版本中引入,开发者可以通过 apply_filters 调用来自定义消息内容。

代码示例

$message = apply_filters( 'site_editor_no_javascript_message', __( 'The site editor requires JavaScript. Please enable JavaScript in your browser settings.' ), $post );

📄 原文内容

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

Parameters

$messagestring
The message being displayed.
$postWP_Post
The post being edited.

Source

$message = apply_filters( 'site_editor_no_javascript_message', __( 'The site editor requires JavaScript. Please enable JavaScript in your browser settings.' ), $post );

Changelog

Version Description
6.3.0 Introduced.