f you want to use OptimizeMember to protect content that is being loaded outside of WordPress you can do so by including
wp-load.php
from the WordPress core files.
<code><?php require_once 'wp-load.php'; if(current_user_can('access_optimizemember_level1')) { // User is allowed to view, so display something here. } else exit('Permission denied!');
This solution uses PHP code and that means the external pages that use this code will need to be PHP files. Files that end in
.htm
or .html
will not be able to use this code unless you’ve specifically configured your web server to parse those file types with PHP.
See: How To Parse HTML Files As PHP for more information.