Support General Password Protection and metaboxes Reply To: Password Protection and metaboxes

#12645
Anh TranAnh Tran
Keymaster

WordPress hard-coded that in its function get_the_content, so there's no filter to do that automatically. Maybe you write a wrapper function for rwmb_meta like this:

function your_meta( $field_id, $args = [], $post_id = null ) {
    if ( post_password_required ) {
        return 'This post is password protected.';
    }
    return rwmb_meta( $field_id, $args, $post_id );
}

Then use your_meta in replace for rwmb_meta.