钩子文档

get_the_post_type_description

💡 云策文档标注

概述

本文档介绍 WordPress 中的 get_the_post_type_description 过滤器,用于自定义文章类型存档页面的描述内容。开发者可以通过此过滤器修改描述字符串,基于文章类型对象进行条件处理。

关键要点

  • 过滤器名称:get_the_post_type_description
  • 参数:$description(字符串,文章类型描述)和 $post_type_obj(WP_Post_Type 对象,文章类型对象)
  • 用途:过滤文章类型存档的描述,允许开发者动态调整或覆盖默认描述
  • 相关函数:get_the_post_type_description(),位于 wp-includes/general-template.php
  • 引入版本:WordPress 4.9.0

📄 原文内容

Filters the description for a post type archive.

Parameters

$descriptionstring
The post type description.
$post_type_objWP_Post_Type
The post type object.

Source

return apply_filters( 'get_the_post_type_description', $description, $post_type_obj );

Changelog

Version Description
4.9.0 Introduced.