[WordPress] 外掛分享: Silent Publish

WordPress 外掛 Silent Publish 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Silent Publish」是 2010-09-08 上架。
  • 目前有 80 個安裝啟用數。
  • 上一次更新是 2020-02-14,距離現在已有 1906 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 4.6 以上版本才可以安裝。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

coffee2code |

外掛標籤

ping | no ping | publish | trackback | update services |

內容簡介

此外掛提供了一個功能,讓你在發布文章時不會觸發 pingbacks、trackbacks 或更新通知的功能。
在「新增文章」和「編輯文章」管理介面中(後者僅限未發佈文章),會新增一個「暗中發佈」的核取方塊。當勾選後發佈文章,該文章將不會觸發 pingbacks、trackbacks 和更新通知。
此外,文章發佈方式和通常一樣:文章會在首頁、封存和訂閱中顯示,其他方面的文章都不受影響。
而在「新增文章/頁面」頁面中,你可關閉 trackbacks 和 pingsbacks 功能,但此外掛也讓你只需勾選一個核取方塊便可關閉這些附加功能,另外還可關閉更新服務通知。此外,這個功能是針對個別作者及其發佈文章。如果要關閉所有作者及其後續發佈文章的更新服務通知,只需清除全局設置的值即可。
如果文章是暗中發佈,將會為該文章設置一個自訂字段「_silent-publish」,並設置值為 1,作為記錄該行為的方法。然而,此值目前未在發佈後使用。如果文章後來重新發佈,此自訂欄位也不會被取消或更改。
如需發佈新文章但不想讓它出現在網站首頁和訂閱中,請參閱「Stealth Publish」插件。這個插件包含此外掛的功能,因此不需要兩者都使用。
連結:插件首頁、插件目錄頁、GitHub、作者首頁。
此外掛可以透過三個篩選器進一步自訂。使用這些篩選器的代碼最好放到 mu-plugin 或特定站台的外掛中(這已超出了此自述文件的範圍)。不太理想的是,你可以將它們放在你的活動佈景主題的 functions.php 文件中。
c2c_silent_publish_meta_key (filter):此篩選器允許你覆寫外掛用於存儲文章暗中發佈狀態的自訂欄位鍵名稱。這不是常見的需要。
參數:
$custom_field_key (string):外掛將使用的自訂欄位鍵。
預設值是「_silent-publish」。
範例:
定義一個自訂欄位鍵供 Silent Publish 使用。
function override_silent_publish_key( $custom_field_key ) {
return '_my_custom_silent-publish';
}
add_filter( 'c2c_silent_publish_meta_key', 'override_silent_publish_key' );
c2c_silent_publish_default (filter):此篩選器允許你覆寫「暗中發佈」核取方塊的預設狀態。
參數:
$state (boolean):核取方塊的預設狀態,預設值為 false。
$post (WP_Post):目前正在創建或修改的文章。
範例:
預設為讓「暗中發佈」核取方塊被勾選。
add_filter( 'c2c_silent_publish_default', '__return_true' );
c2c_silent_publish_post_types (filter):此篩選器允許你自定義文章類型。

原文外掛簡介

This plugin gives you the ability to publish a post without triggering pingbacks, trackbacks, or notifying update services.
A “Publish silently?” checkbox is added to the “Add New Post” and “Edit Post” admin pages (the latter only for unpublished posts). If checked when the post is published, that post will not trigger the pingbacks, trackbacks, and update service notifications that would typically occur.
In every other manner, the post is published as usual: it’ll appear on the front page, archives, and feeds as expected, and no other aspect of the post is affected.
While trackbacks and pingsbacks can already be disabled from the Add New Post/Page page, this plugin makes things easier by allowing a single checkbox to disable those things, in addition to disabling notification of update services which otherwise could only be disabled by clearing the value of the global setting, which would then affect all authors and any subsequently published posts.
If a post is silently published, a custom field ‘_silent-publish’ for the post is set to a value of 1 as a means of recording the action. However, this value is not used after publish for any purpose as of yet. Nor is the custom field unset or changed if the post is later re-published.
Also see my Stealth Publish plugin if you want to make a new post but prevent it from appearing on the front page of your blog and in feeds. (That plugin incorporates this plugin’s functionality, so you won’t need both.)
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Hooks
The plugin is further customizable via three filters. Code using these filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain). Less ideally, you could put them in your active theme’s functions.php file.
c2c_silent_publish_meta_key (filter)
The ‘c2c_silent_publish_meta_key’ filter allows you to override the name of the custom field key used by the plugin to store a post’s silent publish 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 ‘_silent-publish’.

Example:
/**
* Defines a custom meta key to be used by Silent Publish.
*
* @param string $custom_field_key The default custom field key name.
* @return string
*/
function override_silent_publish_key( $custom_field_key ) {
return '_my_custom_silent-publish';
}
add_filter( 'c2c_silent_publish_meta_key', 'override_silent_publish_key' );

c2c_silent_publish_default (filter)
The ‘c2c_silent_publish_default’ filter allows you to override the default state of the ‘Silent Publish?’ 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 Silent Publish? checkbox checked by default.
add_filter( 'c2c_silent_publish_default', '__return_true' );

c2c_silent_publish_post_types (filter)
The ‘c2c_silent_publish_post_types’ filter allows you to override the post types that can be silently published.
Arguments:

$post_types (array): Array of post type names.

Example:
/**
* Disable Silent Publish for a custom public post type 'book'.
*
* @param array $post_types Array of post type names.
* @return array
*/
function my_c2c_silent_publish_post_types( $post_types ) {
$post_types = array_flip( $post_types );
unset( $post_types[ 'book' ] );
return array_keys( $post_types ).
}
add_filter( 'c2c_silent_publish_post_types', 'my_c2c_silent_publish_post_types' );

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Silent Publish」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


2.0 | 2.1 | 2.2 | 2.3 | 2.4 | 2.5 | 2.7 | 2.8 | 2.0.1 | 2.2.1 | 2.4.1 | 2.4.2 | 2.6.1 | trunk |

延伸相關外掛(你可能也想知道)

暫無相關外掛推薦。

文章
Filter
Apply Filters
Mastodon