Put your code in whatever
function:
function whatever(){
// do stuff
}
add_action( 'init', 'whatever' );
Or use this to check whether user is logged in or not:
if( get_current_user_id() ) {
// logged in user
}
Put your code in whatever
function:
function whatever(){
// do stuff
}
add_action( 'init', 'whatever' );
Or use this to check whether user is logged in or not:
if( get_current_user_id() ) {
// logged in user
}