bp_core_no_access_wp_login_error( WP_Error $errors )
Add a custom BuddyPress no access error message to wp-login.php.
Description Description
Parameters Parameters
- $errors
-
(Required) Current error container.
Return Return
(WP_Error)
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;
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.7.0 | Hook moved to 'wp_login_errors' made available since WP 3.6.0. |
| 1.5.0 | Introduced. |