We understand this is annoying. But without advertising-income, we can't keep making this site awesome for you.
Please disable your adblock and script blockers to view this page. Appreciate! 🙏
Home English Articles How to Change WordPress Password Protected Text without Plugins Custom for Every Page

How to Change WordPress Password Protected Text without Plugins Custom for Every Page

by MAL CHIA

How to Change WordPress Password Protected Text without Plugins Custom for Every Page

Are you struggling of WordPress website while locking certain pages or posts with a password to be accessed. But the default WordPress password protected text are too rigid which you wish to show your own custom preview info about these pages.

I do face the same problems before, when I want to lockdown certain post but it show “The content is password protected. To view it please enter your password below:”

How to Change WordPress Password Protected Text without Plugins Custom for Every Page

However, I wish to show some custom preview text instead of this. At the end, the problem come up with a solutions. If you also facing the same problem, then today I’m going to share with you how you can Change WordPress Password Protected Text without Plugins Custom for Every Page.

Other useful tutorial:

 

Change WordPress Password Protected Text

For this solution, you don’t have to download any plugins. But you must make sure your themes is allow to add custom fields.

  1. Go to the top of your edit page/post, click on【Screen Options】
  2. Be sure tick the【Custom Fields】
    How to Change WordPress Password Protected Text without Plugins Custom for Every Page
  3. Add the code below to your functions.php file. If your themes have a child theme, you can just copy these code into your child themes functions.php and save it.
    add_filter('the_content', 'wpfilter_password_protected_message');
    function wpfilter_password_protected_message($content) {
    global $post;
    if (!empty($post->post_password)) {
    $content = str_replace('This content is password protected. To view it please enter your password below:', get_post_meta($post->ID, 'mao_custom_password_text', true) ,$content);
    }
    return $content;
    }
  4. Go to your edit page/post, scroll to the bottom, 【Add Custom Field】name it as【mao_custom_password_text】, the Value field is the preview text you want to show for the password protected page/post.How to Change WordPress Password Protected Text without Plugins Custom for Every Page
  5. Save and preview your custom text.How to Change WordPress Password Protected Text without Plugins Custom for Every Page

 

The above are the How to Change WordPress Password Protected Text without Plugins Custom for Every Page tutorial, it is very easy and convenient to add custom text for each of your password protected page without any third party plugins support. If you find it useful, just do share this tutorial. If you find any problems, please comment below. Thank You

I Save $2,500 And DIY A Website Only $141 [Guide to Make Your Site]

Leave a Comment

You may also like