WordPress Dashboard Widget API is my favorite API in WordPress and sometimes dashboard is my preferred admin page to add simple settings in client site. It’s the screen they will see when they logged in. Why not use it more? In this post I want to share a little about how to properly save the dashboard meta box “Configuration” with the build in nonce validation. A lot of tutorial didn’t even mention this, I don’t even find any reference in Codex page. How to Create Dashboard Widget with Settings? It’s pretty straight forward. You can read for more detail at The Codex Page. In this tutorial we are going to create a dashboard widget with a single input configuration option. The option name is my-dashboard-widget. Here’s the code: /* Setup the Dashboard. */ add_action( 'wp_dashboard_setup', 'my_add_dashboard_widget' ); /* Add Dashboard Widget */ function my_add_dashboard_widget(){     wp_add_dashboard_widget( 'my-dashboard-widget-id', 'My Widget Name', 'my_dashboard_widget_callback', 'my_dashboard_widget_control_callback' ); } /* Widget HTML Output */ function my_dashboard_widget_callback(){     ?>         Your saved input:         
Share This