Remove “Protected” text in title h1 of protected wordpress pages

Found the answer here in the end http://wordpress.org/support/topic/how-to-remove-private-from-private-pages, code as follows

function the_title_trim($title)
  {
   $pattern[0] = '/Protected:/';
    $pattern[1] = '/Private:/';
    $replacement[0] = ''; // Enter some text to put in place of Protected:
    $replacement[1] = ''; // Enter some text to put in place of Private:

    return preg_replace($pattern, $replacement, $title);
  }
  add_filter('the_title', 'the_title_trim');

Leave a Comment