Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: how to deny login from wordpress login page

@drmosko

Participant

thank u for try to help me, but I ask again,
I have many needs for diffrent users, one type of users is buddypress, I dont want all my users to connect through front-end, only buddypress users.
in ur suggestion I will redirect all logins to specific loaction.

so what I did is :

//redirect buddypress users login to frontpage 
function redirect_wp_login_buddypress(){
    global $pagenow;
	$prev_url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
	
	if ( $prev_url ) {
		$prev_path = str_replace( home_url(), '', $prev_url );
		$page = get_page_by_path( $prev_path );
		}
	
	if ( $page->ID == '31' &&	$pagenow == 'wp-login.php') { // buddypress parent page
		wp_redirect( home_url() . '/?p=31/', 301 );
		exit();
		
	}
}
add_action( 'init', 'redirect_wp_login_buddypress' );

$page->ID == '31' 31 is my buddypress frontend page

the problem with this is that if user insert incorrect pass or user name, he will not be noticed, also he wont get resend details option,
can u think of a better way?

Skip to toolbar