do_action( ‘media_buttons’, string $editor_id )

Fires after the default media button(s) are displayed.

Parameters

$editor_idstring
Unique editor identifier, e.g. 'content'.

Source

do_action( 'media_buttons', $editor_id );

Changelog

VersionDescription
2.5.0Introduced.

User Contributed Notes

  1. Skip to note 2 content
    /**
     * Example of how you can add your own custom media
     * button in WordPress editor
     */
    
    function add_media_button() {
            printf( '<a href="%s" class="button my-button my-custom-button" id="my-custom-button">' . '<span class="wp-media-buttons-icon dashicons dashicons-art"></span> %s' . '</a>', '#', __( 'My Custom Button', 'textdomain' ) );
    }
    add_action( 'media_buttons', 'add_media_button' );

You must log in before being able to contribute a note or feedback.