Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
Created November 1, 2017 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2ndkauboy/1e98df1061ea642b47644d59a85c84e6 to your computer and use it in GitHub Desktop.
Save 2ndkauboy/1e98df1061ea642b47644d59a85c84e6 to your computer and use it in GitHub Desktop.
Removes the word "private" and "protected" from the posts title.
<?php
/**
* Remove Private and Protected Title Prefix
* @package RemovePrivateAndProtectedTitlePrefix
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Remove Private Title Prefix
* Plugin URI: https://kau-boys.de
* Description: Removes the word "private" and "protected" from the posts title.
* Version: 0.1
* Author: Bernhard Kau
* Author URI: https://kau-boys.de
* License: GPLv3
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
*/
/**
* Remove the "Private" and "Protected" prefix from headlines
*
* @param string $content Text displayed before the post title. Default 'Private: %s'.
*
* @return string
*/
function remove_private_and_protected_prefix_title_format( $content ) {
return '%s';
}
add_filter( 'private_title_format', 'remove_private_and_protected_prefix_title_format' );
add_filter( 'protected_title_format', 'remove_private_and_protected_prefix_title_format' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment