Skip to content

Instantly share code, notes, and snippets.

@DumahX
Last active April 15, 2022 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DumahX/d4968b08f6d6f2bf8217414078390c38 to your computer and use it in GitHub Desktop.
Save DumahX/d4968b08f6d6f2bf8217414078390c38 to your computer and use it in GitHub Desktop.
Workaround for protecting posts using Avada Builder
<?php
add_action('avada_after_content', function() {
global $post;
if(class_exists('MeprRule') && MeprRule::is_locked($post)) {
$unauth_message = (class_exists('MeprRulesCtrl') ? MeprRulesCtrl::unauthorized_message($post) : '');
echo do_shortcode($unauth_message);
?>
<script>
jQuery(document).ready(function($) {
$('#content .post-content').remove();
});
</script>
<?php
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment