
內容簡介
此外掛允許您選擇在不更新文章的 post_modified 時戳的情況下進行文章更新。
WordPress 維護一個名為 post_modified 的文章欄位,用於追蹤文章上一次編輯的日期。此值用於訂閱以指示每篇文章的最新更新或報告最新更新的文章。插件和佈景主題也可能引用文章修改日期以引起對已更新文章的關注。但是,如果更新是您不希望在 post_modified 時戳中記錄的更改(也許是由於更新是小的格式/編輯更改或修正了錯別字,或者您只想保密更新),則使用此插件。
此插件為任何文章或頁面的「編輯文章」管理頁面的「發布」框中添加了一個「隱藏更新?」複選框。
請注意:插件紀錄文章何時被「隱藏更新?」,因此稍後編輯文章時,該複選框將默認選中。
連結:插件主頁 | 插件目錄頁 | 作者主頁
過濾器
通過兩個篩選器,可以進一步自定義插件。通常,這些自定義將被放入您的活動佈景主題的 functions.php 文件中,或由另一個插件使用。
c2c_stealth_update_meta_key(過濾器)
「c2c_stealth_update_meta_key」過濾器允許您覆蓋插件用於存儲文章隱藏更新狀態的自定義字段鍵的名稱。這不是常見的需求。
參數:
$custom_field_key(字符串):插件要使用的自定義字段鍵。默認情況下,這是「_stealth-update」。
示例:
/**
* 定義 Stealth Update 要使用的自定義元鍵。
*
* @param string $custom_field_key 默認自定義元鍵名稱。
* @return string
*/
function override_stealth_update_key( $custom_field_key ) {
return '_my_custom_stealth-update';
}
add_filter( 'c2c_stealth_update_meta_key', 'override_stealth_update_key' );
c2c_stealth_update_default(過濾器)
「c2c_stealth_update_default」過濾器允許您覆蓋「隱藏更新?」複選框的默認狀態。
參數:
$state(布林值):複選框的默認狀態。默認情況下,為 false。
$post(WP_Post):當前創建/編輯的文章。
示例:
// 預設情況下勾選 Stealth Update 複選框。
add_filter( 'c2c_stealth_update_default', '__return_true' );
外掛標籤
開發者團隊
原文外掛簡介
This plugin allows you to choose to update a post without having WordPress automatically update the post’s post_modified timestamp.
WordPress maintains a post field called post_modified which tracks the date the post was last edited. This value is used by feeds to indicate the latest update to each post or to report the latest updated post. Plugins and themes may also reference the post modification date to call attention to posts that have been updated. However, if an update is such that you don’t want it to be recorded in the post_modified date field (perhaps due to the update being a small formatting/editing change or fixing a typo, or if you just want to keep quiet about an update), then this plugin is for you.
This plugin adds a “Stealth update?” checkbox to the “Publish” box of any post’s or page’s “Edit Post” admin page.
Note: The plugin records when a post is stealth updated, so subsequent edits of the post will have the “Stealth update?” checkbox checked by default.
Links: Plugin Homepage | Plugin Directory Page | Author Homepage
Filters
The plugin is further customizable via two filters. Typically, these customizations would be put into your active theme’s functions.php file, or used by another plugin.
c2c_stealth_update_meta_key (filter)
The ‘c2c_stealth_update_meta_key’ filter allows you to override the name of the custom field key used by the plugin to store a post’s stealth update status. This isn’t a common need.
Arguments:
$custom_field_key (string): The custom field key to be used by the plugin. By default this is ‘_stealth-update’.
Example:
/**
* Defines a custom meta key to be used by Stealth Update.
*
* @param string $custom_field_key The default custom field key name.
* @return string
*/
function override_stealth_update_key( $custom_field_key ) {
return '_my_custom_stealth-update';
}
add_filter( 'c2c_stealth_update_meta_key', 'override_stealth_update_key' );
c2c_stealth_update_default (filter)
The ‘c2c_stealth_update_default’ filter allows you to override the default state of the ‘Stealth Update?’ checkbox.
Arguments:
$state (boolean): The default state of the checkbox. By default this is false.
$post (WP_Post): The post currently being created/edited.
Example:
// Have the Stealth Update? checkbox checked by default.
add_filter( 'c2c_stealth_update_default', '__return_true' );
