Give your team a shared notes box on the dashboard for logins, reminders and handover notes, editable by administrators.
add_action( 'wp_dashboard_setup', function (): void {
wp_add_dashboard_widget( 'nahnu_site_notes', 'Site notes', function (): void {
$notes = (string) get_option( 'nahnu_site_notes', '' );
echo $notes ? wp_kses_post( wpautop( $notes ) ) : '<p>No notes yet.</p>';
if ( current_user_can( 'manage_options' ) ) {
?>
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
<input type="hidden" name="action" value="nahnu_save_site_notes">
<?php wp_nonce_field( 'nahnu_site_notes' ); ?>
<textarea name="nahnu_site_notes" rows="6" style="width:100%"><?php echo esc_textarea( $notes ); ?></textarea>
<p><button type="submit" class="button button-primary">Save notes</button></p>
</form>
<?php
}
} );
} );
add_action( 'admin_post_nahnu_save_site_notes', function (): void {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( 'Not allowed.' );
}
check_admin_referer( 'nahnu_site_notes' );
update_option( 'nahnu_site_notes', wp_kses_post( wp_unslash( $_POST['nahnu_site_notes'] ?? '' ) ), false );
wp_safe_redirect( admin_url( 'index.php' ) );
exit;
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
Every site has things the team needs to remember: which plugin handles redirects, when the SSL renews, who to call about hosting. This snippet adds a notes box to the dashboard that everyone can read and administrators can edit.
wp_add_dashboard_widget() registers the widget. It shows the saved notes, with line breaks turned into paragraphs, to everyone who can see the dashboard. Administrators also get a textarea and Save button.
The form posts to admin-post.php, where the handler checks the user can manage options, verifies the nonce, cleans the text with wp_kses_post() so only safe HTML is kept, and saves it as a non-autoloaded option.
Open the dashboard, type a note and click Save notes. It should appear above the form, and an editor should see it without the form.