How to hide media menu items in my custom plugin? (WordPress)

Solution:1

You can create plugin for this (i.e. Remove attachment filed). Below are the steps to create plugin for your requirement:

1) Create one folder inside wp-content/plugin (i.e. Remove attachment filed)

2) Inside newly created folder create one file (i.e remove_attachment_details.php) with below code.

3) Activate the plugin from Admin >> Plugins

<?php
  /*
      Plugin Name: Remove attachment filed
  */
add_action('admin_head-post.php', 'hide_media_stuff_wpse_120894' );
add_action('admin_head-post-new.php', 'hide_media_stuff_wpse_120894' );

function hide_media_stuff_wpse_120894(){
    ?>
    <style type="text/css">
        .attachment-details [data-setting="title"],
        .attachment-details [data-setting="caption"],
        .attachment-details [data-setting="alt"],
        .attachment-details [data-setting="description"],
        div.attachment-display-settings
        {
            display:none
        }
    </style>
    <?php
}
?>

Solution:2

You can create plugin for this (i.e. Remove attachment filed). Below are the steps to create plugin for your requirement:

1) Create one folder inside wp-content/plugin (i.e. Remove attachment filed)

2) Inside newly created folder create one file (i.e remove_attachment_details.php) with below code.

3) Activate the plugin from Admin >> Plugins

<?php
  /*
      Plugin Name: Remove attachment filed
  */
add_action('admin_head-post.php', 'hide_media_stuff_wpse_120894' );
add_action('admin_head-post-new.php', 'hide_media_stuff_wpse_120894' );

function hide_media_stuff_wpse_120894(){
    ?>
    <style type="text/css">
        .attachment-details [data-setting="title"],
        .attachment-details [data-setting="caption"],
        .attachment-details [data-setting="alt"],
        .attachment-details [data-setting="description"],
        div.attachment-display-settings
        {
            display:none
        }
    </style>
    <?php
}
?>