Mika MAtikainen
Apr 15, 2020 · 4 min read
How can I remove the ‘Private’ or ‘Protected’ label from my post titles in WordPress?
function wpsc_the_title_trim($title) {
$title = attribute_escape($title);
$findthese = array(
'#Protected:#',
'#Private:#'
);
$replacewith = array(
'', // What to replace "Protected:" with
'' // What to replace "Private:" with
);
$title = preg_replace($findthese, $replacewith, $title);
return $title;
}
add_filter('the_title', 'wpsc_the_title_trim');