'Wordpress how to remove fields from media library
I am looking to remove the 2 fields in the media library however I am unsure how to do so. I am trying to create a plugin for this. The follow code is not working
<?php
/*
Plugin Name: Remove media fields
Version: 1.0
Author: Jerry Seigle
*/
// edit fields in media upload area
add_filter('attachment_fields_to_edit', 'remove_media_upload_fields', 10000, 2);
function remove_media_upload_fields( $form_fields, $post ) {
// remove unnecessary fields
unset( $form_fields['image-size'] );
unset( $form_fields['post_excerpt'] );
unset( $form_fields['post_content'] );
unset( $form_fields['url'] );
unset( $form_fields['image_url'] );
unset( $form_fields['align'] );
unset( $form_fields['image_alt'] );
return $form_fields;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

