Notice: bp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 1.7.) in /…/wp-includes/functions.php on line 3622
If you’re getting the above notice, you’re going to need to disable _doing_it_wrong for the bbp_setup_current_user()
function, here’s how!
/**
* Disables trigger_error for doing_it_wrong_trigger_error filter.
*
* @return boolean false disables the if condition to trigger the error display.
*/
function remove_bbp_setup_current_user_notice_filter() {
return false; // Disable trigger_error.
}
/**
* If bbp_setup_current_user() runs _doing_it_wrong(), disable trigger_error.
*
* @param string $function The function, here we test for bbp_setup_current_user().
* @param string $message The message (no modifications here).
* @param string $version Version (not used here).
*/
function remove_bbp_setup_current_user_notice( $function, $message, $version ) {
if( 'bbp_setup_current_user' === $function ) {
// Filter trigger_error
add_filter( 'doing_it_wrong_trigger_error', 'remove_bbp_setup_current_user_notice_filter' );
}
}
add_action( 'doing_it_wrong_run', 'remove_bbp_setup_current_user_notice', 10, 3 );