钩子文档

document_title

💡 云策文档标注

概述

本文档介绍了 WordPress 中的 'document_title' 过滤器,用于过滤文档标题。它允许开发者修改页面标题字符串。

关键要点

  • 'document_title' 过滤器用于过滤文档标题字符串。
  • 参数 $title 是文档标题字符串。
  • 通过 apply_filters('document_title', $title) 调用此过滤器。
  • 相关函数 wp_get_document_title() 返回当前页面的文档标题。
  • 此过滤器在 WordPress 5.8.0 版本中引入。

📄 原文内容

Filters the document title.

Parameters

$titlestring
Document title.

Source

$title = apply_filters( 'document_title', $title );

Changelog

Version Description
5.8.0 Introduced.