0

I want to use a different icon for Add Media button in the standard post editing form. What's the best way of doing it?

2

CSS is the way to go here.

Add a new CSS for admin using the admin_enqueue_scripts hook in your child theme functions.php (if you don't have one, you're doing something wrong)

function my_admin_enqueue_style() {
    wp_enqueue_style('my-css', get_stylesheet_directory_uri().'/css/my-admin.css', array(), '1.0.0');
}
add_action('admin_enqueue_scripts', 'my_admin_enqueue_style');

In your my-admin.css file

/* change the content to another Dashicon */
#wp-content-editor-tools .wp-media-buttons .add_media span.wp-media-buttons-icon::before {
    content: "\f104";
}

/* or set a background-image instead (set content to "" in the rule before) */
#wp-content-editor-tools .wp-media-buttons .add_media span.wp-media-buttons-icon {
    background-image: url(../../wp-content/uploads/2017/10/my-image.png);
    background-position: center;
}

Available Dashicon icons here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.