Skip to content

Instantly share code, notes, and snippets.

@mbijon
Last active July 10, 2023 23:30
Show Gist options
  • Save mbijon/7311081 to your computer and use it in GitHub Desktop.
Save mbijon/7311081 to your computer and use it in GitHub Desktop.
Remove 'Add Media' button from above WP editor, per post-type
function check_post_type_and_remove_media_buttons() {
global $current_screen;
// use 'post', 'page' or 'custom-post-type-name'
if( 'post' == $current_screen->post_type ) add_action( 'media_buttons_context' , create_function('', 'return;') );
}
add_action('admin_head','check_post_type_and_remove_media_buttons');
@trublud
Copy link

trublud commented Jul 10, 2023

Here is another way
$settings = array('textarea_name'=>'Overview[Notes]') ;
$settings['media_buttons'] = false;
wp_editor( htmlspecialchars_decode($text), 'mettaabox_ID2', $settings );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment