i maked normal page in category - knowlege.
i want this page view login user.
however, now all user view in this page.
What should I do?
site : k-desi9n.kr/edu
submaster / alpha1234
@endifelse,
Please paste the below code in wp-admin > Plugins > Editor > Select WPLMS Customizer Plugin > wplms-customizer.php
In the below code i have written 6. Instead of that you have to put there your page id. Hover on the edit page link and you'll get the page id
refer: http://prntscr.com/kd8unl
add_action( 'template_redirect', 'protect_goal_page' );
function protect_goal_page() {
global $post;
if( $post->ID == 6 ){
if( ! is_user_logged_in() ){
wp_redirect( home_url());
}
}
}
Thank you for teaching me.
But instead of adding an id each time you write,
is there any way you can aplly all the text at once?
In addition, an error message is displayed when an alert window is placed here.
if( ! is_user_logged_in() ){
alert("please login!") <<-- error
wp_redirect( home_url());
}
@endifelse
In your above post you have showed me that knowledge page so i thought you want to limit the access for only that particular page. Please tell me do you want it for each and every page and post?
So that non-logged in users cannot access that page
Limited to knowledge pages.
There are several pages in the knowledge page,
It is inconvenient to write an id every time you write.
So I ask you how you can solve it at once.
@endifelse,
If these pages are under Knowledge page and when you paste the above code. A non-logged in user cannot access the Knowledge page so it is not possible to access the pages inside the knowledge page for a non-logged-in user