HowTo – Writing WordPress Plugins Adding Your Option Picker To The New Post Page

Filed under: Wordpress Tips

wordpress-logoIf you are writing a WordPress plugin that needs to have an option box added to the New Post Page then you need to use the add_action to add your checkbox or radio selector item.

How to do this:

Write Your Function

First write your function that may go to the DB and grab a current value and or display the checkbox or other form tool you will use to set the value of your option.

function myplugin_options() {

Blah blah blah read the db and do what you need to
Then echo the thingy you want to show on the Add New Post Page.

echo ‘
<input type=”radio” name=”myplugin” id=”myplugin_yes” value=”yes” ‘.$ischecked.’ /> <label for=”myplugin_yes”>Yes</label> &nbsp;&nbsp;


Now Add It To The Add New Post page

Now to add your thingy to the Add New Post Page so your users can access it when they are writing a new page.

add_action(‘edit_form_advanced’, ‘myplugin_options’)


There are two main ways to add content to WordPress.

Either a Post or a Page.
The above example shows how to add your thingy to the ADD NEW POST page.


If you want to add the same thing to your Add New Page … Page then use


or an example

add_action(edit_page_form‘, ‘myplugin_options’)


What you add to the New Posts or Pages edit pages is up to you.
Your plugin or function will need to work on its own but to get an option thingy on that page so your users can access it… use the code above.

Make your Function including the echo for your checkbox or other selector.
Then call to add_action to place your code on the page.

I hope this helps.