Skip to content

Instantly share code, notes, and snippets.

@wpspeak
Forked from anonymous/functions.php
Last active December 18, 2015 11:59
Show Gist options
  • Save wpspeak/5780042 to your computer and use it in GitHub Desktop.
Save wpspeak/5780042 to your computer and use it in GitHub Desktop.
<?php
// Removee "Protected" and "Private" from Protected and Private Posts
function afn_title_trim($title) {
$title = attribute_escape($title);
$findthese = array(
'#Protected: #', // Notice the blank space after Protected:
'#Private: #' // Notice again, otherwise the title get pushed.
);
$replacewith = array(
'', // What to replace "Protected: " with
'' // What to replace "Private: " with
);
$title = preg_replace($findthese, $replacewith, $title);
return $title;
}
add_filter('the_title', 'afn_title_trim');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment