Hello @wpbetsy
You can use below filter for that.
add_filter('wt_user_allowed_posts', 'redirect_to_custom_page');
function redirect_to_custom_page($posts){
if(empty($posts)){
// wp_redirect(wp_login_url()); // redirect to login
// $posts = array(200); // Change the 200 to your cutom page post ID
}
return $posts;
}
Please leave a review if plugin/support was helpful
Can you make this available in next plugin update?
Hi @wpbetsy
We will check the possibilities of including this as a plugin option. For the time being, you can use the above code snippet.
Hi @wpbetsy
We have introduced option to set default access denied page. You won’t need to add the code snippet anymore. Please update the plugin to the latest version.
It doesn’t work. How to do it?
Hi @wpbetsy
Set a default access denied page under settings ( http://www.mydomain.com/wp-admin/admin.php?page=wc-settings&tab=hf_memberships )
When a visitor accessing a page that’s restricted will be redirected to the page set in the above settings.
No need, I just want to redirect them to login page but it doesn’t work. Do I set “All members” if I want the page only accessible to registered members?