Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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