钩子文档

post_unstuck

💡 云策文档标注

概述

post_unstuck 是一个 WordPress 动作钩子,在文章从置顶列表中移除时触发,主要用于开发者执行自定义操作。

关键要点

  • 触发时机:当文章被取消置顶时立即执行
  • 参数:$post_id(整数类型),表示被取消置顶的文章ID
  • 相关函数:unstick_post() 用于取消文章置顶
  • 版本历史:自 WordPress 4.6.0 版本引入

代码示例

do_action( 'post_unstuck', $post_id );

📄 原文内容

Fires once a post has been removed from the sticky list.

Parameters

$post_idint
ID of the post that was unstuck.

Source

do_action( 'post_unstuck', $post_id );

Changelog

Version Description
4.6.0 Introduced.