bp_core_no_access_wp_login_error( WP_Error $errors )

Add a custom BuddyPress no access error message to wp-login.php.

Parameters Parameters


(WP_Error) (Required) Current error container.

Top ↑

Return Return


Source Source

File: bp-core/bp-core-catchuri.php

function bp_core_no_access_wp_login_error( $errors ) {
	if ( empty( $_GET['action'] ) || 'bpnoaccess' !== $_GET['action'] ) {
		return $errors;

	 * Filters the error message for wp-login.php when needing to log in before accessing.
	 * @since 1.5.0
	 * @param string $value Error message to display.
	 * @param string $value URL to redirect user to after successful login.
	$message = apply_filters( 'bp_wp_login_error', __( 'You must log in to access the page you requested.', 'buddypress' ), $_REQUEST['redirect_to'] );

	$errors->add( 'bp_no_access', $message );

	return $errors;

Top ↑

Changelog Changelog

Version Description
2.7.0 Hook moved to 'wp_login_errors' made available since WP 3.6.0.
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.