钩子文档

default_excerpt

💡 云策文档标注

概述

default_excerpt 是一个 WordPress 过滤器,用于修改在“撰写文章”表单中初始使用的默认文章摘要。它允许开发者在文章编辑界面加载时自定义摘要的默认内容。

关键要点

  • 过滤器名称:default_excerpt
  • 主要用途:过滤“撰写文章”表单中的默认文章摘要
  • 参数:$post_excerpt(字符串,默认文章摘要)和 $post(WP_Post 对象,文章对象)
  • 源代码示例:$post->post_excerpt = (string) apply_filters( 'default_excerpt', $post_excerpt, $post );
  • 相关函数:get_default_post_to_edit(),用于返回“撰写文章”表单的默认文章信息
  • 引入版本:WordPress 1.5.0

📄 原文内容

Filters the default post excerpt initially used in the “Write Post” form.

Parameters

$post_excerptstring
Default post excerpt.
$postWP_Post
Post object.

Source

$post->post_excerpt = (string) apply_filters( 'default_excerpt', $post_excerpt, $post );

Changelog

Version Description
1.5.0 Introduced.