Skip to content

Instantly share code, notes, and snippets.

@donaldallen
Last active December 21, 2015 04:59
Show Gist options
  • Save donaldallen/6253869 to your computer and use it in GitHub Desktop.
Save donaldallen/6253869 to your computer and use it in GitHub Desktop.
WordPress: Admin notices
add_action('admin_notices', function() {
$action = (isset($_REQUEST['action']) ? $_REQUEST['action'] : null);
if ($action && $_REQUEST['page'] == 'mvc_events') {
$notice = '<div class="updated"><p>';
if ($action == 'delete') {
$notice .= 'Successfully deleted.';
} elseif ($action == 'cancel') {
$notice .= 'Successfully cancelled.';
} elseif ($action == '-1') {
$notice .= 'You need to select an event.';
}
$notice .= '</p></div>';
echo $notice;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment