All posts returned when author of 0 is queried
Welcome to WPSE. The condition you want to prevent is a ID of 0 so only run the query if it does not. Also, DRY – don’t repeat yourself. Rather than call get_current_user_id() multiple times, call it once and store it. $reg_count= 0; $user_id = get_current_user_id(); if ( 0 !== $user_id ) { echo “looking … Read more