Title: Adding meta box with action button
Last modified: August 21, 2016

---

# Adding meta box with action button

 *  [One234](https://wordpress.org/support/users/one234/)
 * (@one234)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-meta-box-with-action-button/)
 * Hey guys,
    i want to create a small newsletter plugin, which can send the mails
   out of the edit post page. I will add a metabox, and dont know how to create 
   a button in this metabox which will start my action. I think its easy but i couldnt
   find the right example.
 * TIA

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-meta-box-with-action-button/#post-4363373)
 * Meta boxes are inside the post edit form tags, so you do not want a true submit
   button because that would submit the entire edited post form to be published 
   or updated.
 * Instead, provide a object that invokes a jQuery function when clicked. That function
   submits an AJAX request. Your AJAX handler is what actually does the mailing.
   For more on AJAX, you could start with [AJAX in Plugins](http://codex.wordpress.org/AJAX_in_Plugins).
 *  Thread Starter [One234](https://wordpress.org/support/users/one234/)
 * (@one234)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-meta-box-with-action-button/#post-4363377)
 * Hi bcworkz,
    thank you for your reply.
 * I understand, I think i will try to use a checkbox which will be checked at save_post,
   if this ist checked, i will send the mail.
 * Will this work and have you an good example for that?
 * TIA 🙂
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-meta-box-with-action-button/#post-4363414)
 * Yes that will work, and is easier to code than my suggestion. It’s not a “good”
   example, but there is a [mail on post_save](http://codex.wordpress.org/Plugin_API/Action_Reference/save_post#Examples)
   example. The difference being you need to check that the $_POST element keyed
   by the checkbox name is set before sending the mail. And the mail recipients 
   would be different of course.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Adding meta box with action button’ is closed to new replies.

## Tags

 * [metabox](https://wordpress.org/support/topic-tag/metabox/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/adding-meta-box-with-action-button/#post-4363414)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
