bp_core_admin_notice_dismiss_callback()
Catch and process an admin notice dismissal.
Description
Source
File: bp-core/admin/bp-core-admin-functions.php
function bp_core_admin_notice_dismiss_callback() { if ( ! current_user_can( 'install_plugins' ) ) { wp_send_json_error(); } if ( empty( $_POST['nonce'] ) || empty( $_POST['notice_id'] ) ) { wp_send_json_error(); } $notice_id = wp_unslash( $_POST['notice_id'] ); if ( ! wp_verify_nonce( $_POST['nonce'], 'bp-dismissible-notice-' . $notice_id ) ) { wp_send_json_error(); } bp_update_option( "bp-dismissed-notice-$notice_id", 1 ); wp_send_json_success(); }
Changelog
Version | Description |
---|---|
BuddyPress 2.7.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.