Change Private and Protected text in entries

WordPress allows us to define entries as private and protected . It’s as easy as choosing the visibility option in the post editor.

Now, we do not always like the default text or it is appropriate for our site, and if we do not want to completely change the translation file, we can easily modify those texts that precede these types of input.

As we already learned how to remove the Private and Protected legend , now we are going to learn how to modify it. All we have to do is the following …

Change the prefix «Private»

We add the following code to the functions.php file of the active theme:

function change_private_title_prefix() {
    return 'Solo para suscriptores: %s';
}
add_filter('private_title_format', 'change_private_title_prefix');

Change the prefix «Protected»

The same, we add this code to the functions.php file of the theme that we have active:

function change_protected_title_prefix() {
    return 'Secreto: %s';
}
add_filter('protected_title_format', 'change_protected_title_prefix');

Then you put the text that you like the most here too.

( 1 votes, average: 5 ) Rate this article to help improve the quality of the blog
Share on Twitter Share on Facebook Share on Pocket Share on LinkedIn Share on WhatsApp Share on Telegram

Did you like this article? You can’t imagine what you’re missing on YouTube !

NOTICE : This post is 3 years old or older. If it is a code or a plugin it might not work in the latest versions of WordPress, and if it is news it could be already out of date. Then do not say that we have not warned you. Ah! It works for you? Well then I have not said anything 🙂

About Us

We are BE OF THEM, a team specialized in the field of digital marketing and programming, our headquarters is in Germany, and our activity has expanded to reach all parts of the Middle East, especially the Arab Gulf countries.

Do you need to raise your site's score?

We have the perfect solution for marketing your business

Contact Us

Call us, or message us by email & whatsapp

We will be happy to talk to you, and knowing everything about your work.

All rights reserved, © 2021