do_action( 'media_buttons', string $editor_id )

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


Description Description


Parameters Parameters

$editor_id

(string) Unique editor identifier, e.g. 'content'.


Top ↑

Source Source

File: wp-includes/class-wp-editor.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Mahfuz Rahman
    /**
     * 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.