get_sample_permalink_html
云策文档标注
概述
get_sample_permalink_html 是一个 WordPress 过滤器钩子,用于修改示例固定链接的 HTML 标记。它允许开发者在后台编辑文章时自定义固定链接预览的显示内容。
关键要点
- 过滤器钩子名称:get_sample_permalink_html
- 主要参数:$return(示例固定链接 HTML 标记)、$post_id(文章 ID)、$new_title(新标题)、$new_slug(新别名)、$post(WP_Post 对象)
- 用途:过滤或修改示例固定链接的 HTML 输出,常用于自定义后台编辑界面
- 相关函数:get_sample_permalink_html() 用于返回示例固定链接编辑器的 HTML
- 版本历史:从 WordPress 2.9.0 引入,4.4.0 版本添加了 $post 参数
原文内容
Filters the sample permalink HTML markup.
Parameters
$returnstring-
Sample permalink HTML markup.
$post_idint-
Post ID.
$new_titlestring|null-
New sample permalink title.
$new_slugstring|null-
New sample permalink slug.
$postWP_Post-
Post object.
Source
$return = apply_filters( 'get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post );