How do I create a section in the dashboard w/ an input field

This is pretty easy to do with the Dashboard Widgets API http://codex.wordpress.org/Dashboard_Widgets_API.

Here are the steps I would take to create this:

  1. Queue up a jQuery script for AJAX handling
  2. Create a PHP AJAX function and corresponding AJAX hook for saving the form data
  3. Create the dashboard widget with HTML form input(s)

Here’s a sample for adding a simple dashboard widget:

function foo_dash_widget_content() {
    //Insert your form element with AJAX capability
}

function foo_dash_widget() {
    wp_add_dashboard_widget('foo-dash', __('Foo Dash Widget', 'foodash'), 'foo_dash_widget_content');
} 
add_action('wp_dashboard_setup', 'foo_dash_widget');

Leave a Comment