Hello, In this post I’ll show you how to change or remove the Protected prefix. If you set any page or post password protected, Then this prefix will display before your post or page title.

protected screenshot

Before you start make sure that you have created child theme, So that all your changes remain intact after the parent theme update.

Change “Protected:” prefix :

To change prefix you have to access “functions.php” file in the theme directory. All WordPress theme contains this file. You can access it from WordPress dashboard, FTP or using cPanel.

Note : Details about how to access this file given further below in the post.

Now access “functions.php” file, Edit it and add this code at very bottom, In the last line.

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

Now change the word “Protected” given in the code according to your wish and save the file.


Remove “Protected:” prefix :

To remove prefix you have to access “functions.php” file in the theme directory. You can access this file from WordPress dashboard, FTP or using cPanel.

Note : Details about how to access this file given further below in the post.

So access “functions.php” file, Edit it and add this code at very bottom, In the last line.

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

Detailed steps to access “functions.php” file :

  • Using WordPress Dashboard : Go to the Appearance > Theme Editor, Open “functions.php“, Scroll down the file, Press enter and paste code given below. And update the file.
dashboard image
  • Using FTP : Lot of tools available to access core files on server, I am using Filezila and OpenShop theme as an example. After logging go to the “/wp-content/themes/openshop” and open “functions.php” file in available file editor and add code given below.
ftp image
  • Using cPanel : Login cPanel go to the public_html/wp-content/themes/openshop, Edit “functions.php” and paste code in the last line and save file.
cPanel image

Conclusion :

Process given above require editing in theme core file. Make sure that you are working with child theme, So that all your changes remain intact after theme update.
Editing core file may result error, So please backup “functions.php” file and add code carefully.

I hope this post is helpful for you. Please feel free to contact our support staff in case of any query. We provide help using live chat, email and support forum.

Read More –