Site logo

Archived topic

Private Page Heading

1 reply · Started by Lee on March 3, 2021

Viewing posts 1–2 of 2

Hey guys,

I've created a private page on my website all well and good. However, the title shows up with the word "Private" along with the title that I've chosen. But I'd like to remove the "Private".

I've done a little research and I've found this:

First go with WordPress Dashboard >Appearance >Editor section.
In editor section there is a functions.php file of your theme. In this file add the following code at the end of the file :

/**
* Removes or edits the 'Protected:' part from posts titles
*/
add_filter( 'protected_title_format', 'remove_protected_text' );
function remove_protected_text() {
return __('Protected: %s');
}

However, I don't want to be messing with the theme code without knowing if this advice is sound.

Does this look right to you, or is there an easier way of removing the "Private" in the title?

Many thanks in advance,

Hi there,

never make any edits to the Theme files as those changes will be lost when the theme update.
This article explains how to add PHP snippets like that to your site:

https://docs.generatepress.com/article/adding-php/

TLDR: If you're using a child theme need you can add it to the child theme functions.php. If you have no child theme then install the Code Snippets plugin and create a new snippet to add the code to.

This archived topic is closed to new replies.