modemlooper avatar
About Blog

Remove BuddyPress Missing Page Notice

1 min read
wordpress buddypress php

If you do not create a page for every BuddyPress component it shows an admin notice to create the pages. This code removes the notice.

/**
 * Remove BP pages admin notice.
 *
 * @return void
 */
function modemlooper_remove_bp_pages_notices() {

	$notices = buddypress()->admin->notices;

	foreach ( $notices as $key => $notice ) {

		$message = $notice['message'];

		if ( strpos( $message, 'The following active BuddyPress Components do not have associated BuddyPress Pages' ) !== false ) {
			unset( buddypress()->admin->notices[ $key ] );
		}
	}
}
add_action( 'admin_init', 'modemlooper_remove_bp_pages_notices' );