Some requirement comes to access specific portion of wordpress website to specific user only. So here is the code define Access on specific content in WordPress for a specific user only.
Update this code into Your template page like page.php, singlepost.php or wherever u want to do this.
<?php if(is_user_logged_in()): wp_get_current_user(); if ( (8 == $current_user->ID) || (1 == $current_user->ID) || (7 == $current_user->ID) ) { ?> /// Write your php code or function which you want to execute here if User who having ID 8,1,7 to see this area. echo 'Content for Users ID = 1,7,8'; <?php } else { // Else Part Where Other LoggedIn Users which having ID 1,7,8 will see this area. echo 'Content for Otherthan User ID = 1,7,8'; } else: /// Else Area to Put php funtion or code to saw theme who is not logged into Your wordpress website. echo 'Who are not logged in'; endif; ?>
0 Comments.