Last active
April 28, 2023 08:25
-
-
Save mattiasghodsian/21ab3ce7773eab1c4c0ca50fd5b43675 to your computer and use it in GitHub Desktop.
[Wordpress] Fix Password Protect pages with Elementor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fix Password Protect pages with Elementor | |
* | |
* Author: Mattias Ghodsian | |
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian | |
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5 | |
* | |
* @param string $content | |
* @return html | |
*/ | |
add_action( 'elementor/frontend/the_content', function( $content ) { | |
GLOBAL $post; | |
if ( strpos($content, 'elementor-location-single') !== false && post_password_required( $post ) ) | |
return '<div class="content-protected">'.get_the_password_form().'</div>'; | |
return $content; | |
}); |
I also love you so much, do you have another way to send you a coffee? My paypal is super derped
You'r welcome, I have updated the snippets donate link
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also love you so much, do you have another way to send you a coffee? My paypal is super derped