• I am writing a WordPress plugin and I want to add a new button at Upload/Insert section (just above the editor, like Add an Image button) which will open a php file, generate some code and insert that code in the editor. How to do that?

Viewing 1 replies (of 1 total)
  • Thread Starter laurnicolae

    (@laurnicolae)

    I found the solution.
    The code is:

    function plugin_media_button($context) {
    	$plugin_media_button = ' %s' . '<a href="media-upload.php?type=wp_myplugin&TB_iframe=true" class="thickbox">Insert something</a>';
    	return sprintf($context, $plugin_media_button);
      }
      add_filter('media_buttons_context', 'plugin_media_button');

Viewing 1 replies (of 1 total)
  • The topic ‘Add button to wordpress Upload/Insert section’ is closed to new replies.