钩子文档

get_the_archive_title_prefix

💡 云策文档标注

概述

get_the_archive_title_prefix 是一个 WordPress 过滤器,用于修改存档标题的前缀。它允许开发者自定义或移除存档页面标题的前缀部分。

关键要点

  • 这是一个过滤器 Hook,名称为 get_the_archive_title_prefix。
  • 参数 $prefix 是存档标题的前缀字符串。
  • 通过 apply_filters 调用,开发者可以添加过滤器函数来修改前缀。
  • 相关函数 get_the_archive_title() 用于基于查询对象检索存档标题。
  • 从 WordPress 5.5.0 版本开始引入。

代码示例

// 移除所有存档标题前缀
add_filter( 'get_the_archive_title_prefix', '__return_false' );

📄 原文内容

Filters the archive title prefix.

Parameters

$prefixstring
Archive title prefix.

Source

$prefix = apply_filters( 'get_the_archive_title_prefix', $prefix );

Changelog

Version Description
5.5.0 Introduced.

User Contributed Notes