-
-
Save mbijon/7311081 to your computer and use it in GitHub Desktop.
@dbshoupe. Code work for me. Thank you.
Thanks @dbshoupe thats works for me.
Thanks @dbshoupe this worked for me.
How would it need to be modified to check for more than one custom post type please?
thanks
I remove the media buttons by setting the media_buttons
setting to false
in the wp_editor_settings
filter:
/**
* Removes media buttons from post types.
*/
add_filter( 'wp_editor_settings', function( $settings ) {
$current_screen = get_current_screen();
// Post types for which the media buttons should be removed.
$post_types = array( 'post' );
// Bail out if media buttons should not be removed for the current post type.
if ( ! $current_screen || ! in_array( $current_screen->post_type, $post_types, true ) ) {
return $settings;
}
$settings['media_buttons'] = false;
return $settings;
} );
@deadhead1971 You could add your own post types to the $post_types
array if you want to have a check for more than one post type.
@gchtr thanks!
I remove the media buttons by setting the
media_buttons
setting tofalse
in thewp_editor_settings
filter:/** * Removes media buttons from post types. */ add_filter( 'wp_editor_settings', function( $settings ) { $current_screen = get_current_screen(); // Post types for which the media buttons should be removed. $post_types = array( 'post' ); // Bail out if media buttons should not be removed for the current post type. if ( ! $current_screen || ! in_array( $current_screen->post_type, $post_types, true ) ) { return $settings; } $settings['media_buttons'] = false; return $settings; } );
@deadhead1971 You could add your own post types to the
$post_types
array if you want to have a check for more than one post type.
This worked for me. Thank you!
Here is another way
$settings = array('textarea_name'=>'Overview[Notes]') ;
$settings['media_buttons'] = false;
wp_editor( htmlspecialchars_decode($text), 'mettaabox_ID2', $settings );
This did not work for me in WordPress 4.4.2.24. Had to change it to below:
function check_post_type_and_remove_media_buttons() {
global $current_screen;
// use 'post', 'page' or 'custom-post-type-name'
if( 'services' == $current_screen->post_type ) remove_action('media_buttons', 'media_buttons');
}
add_action('admin_head','check_post_type_and_remove_media_buttons');