how to check login and show the wordpress selected category

i have to show some of the category page on post login,

How do i check the category id = 652

Then User logged in or not details,

if the user logged in the page will be display or this page will redirect to login page.

/* Code */

add_action( ‘template_redirect’, ‘redirect_to_specific_page’ );

function redirect_to_specific_page() {

if ( get_the_ID(‘652, 629, 565’) && is_user_logged_in() ) {
display 652 page
} else{

wp_redirect( ‘http://google.com/’, 301 );
exit;
}

}

Read more here:: how to check login and show the wordpress selected category

Leave a Reply

Your email address will not be published. Required fields are marked *