0

I’m trying to change content that is on the password-protected post from the plugin. When using content filter it seems not to work (redirect to wp-login.php gives the blank screen). Is there more appropriate filter for this?

My current code:

function change_client_post_type($content) {
     if(post_password_required()):
        $content = get_the_password_form();
     else: 
        ...content
     endif;

     return $content;
 } 
3
  • is this your actual code? with an ellipsis? did you check your error log?
    – rudtek
    Nov 8, 2017 at 17:18
  • @rudtek No, there is actual loop which I’m not posting for brevity
    – Runnick
    Nov 8, 2017 at 17:32
  • Can't trouble shoot without details. What about the log?
    – rudtek
    Nov 8, 2017 at 17:34

1 Answer 1

0

Actually you just need to return $content, not the form.

function change_client_post_type($content) {
 if(post_password_required()):
    return $content; //solution
 else: 
    ...content
 endif;

 return $content;

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.