Silent Publish

Silent Publish Install Statistics

0
100%
Today: 0 Yesterday: 0 All-time: 5,658 downloads
Silent Publish Icon

Try plugin: Silent Publish

We'll create fresh WordPress site with Silent Publish installed. You have 20 minutes to test the plugin after that site we'll be deleted.

Takes ~10 seconds to install.

About Silent Publish

Adds the ability to publish a post without triggering pingbacks, trackbacks, or notifying update services.

0


1


0


0


0

updated: 4 years ago
since: 14 years ago
author: Scott Reilly

Description

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' );