Skip to content
Advertisement

Hide specifics elements from “Add media” in WP

Trying to hide some elements “actions” from the “Add Media” window. the thing is, I need to hide those actions in a specific post type

Tried the following snippet, of course not working

<?php
add_action( 'wp_head', function () { ?>
<style>
    
    .media-menu-item #menu-item-featured-image {
    display: none;
    }

</style>
<?php } );

enter image description here

enter image description here

Advertisement

Answer

The only mistake is that the id “menu-item-featured-image” is not a child for the class “media-menu-item”, but it is the same element

enter image description here

so just delete the space between “.media-menu-item” and “#menu-item-featured-image”

.media-menu-item#menu-item-featured-image {
  display: none;
}
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement