• How To?
  • Tips ‘n Tricks
  • WordPress
  • Snippets
  • Software
    • Browsers
    • Downloads
  • Web
  • Tools
    • Character Counter
    • chmod Calculator
    • Entities Encoder
    • Live HTML Editor
    • My IP
  • Contact
Twitter Facebook Google+ RSS
You are here: SumTips » Tips 'n Tricks » Add or Remove Tabs from WordPress 3.5 Media Manager

Add or Remove Tabs from WordPress 3.5 Media Manager

Posted on December 31, 2012 by Renji | Short URL: http://sumtips.com/?p=7898

WordPress 3.5 comes with a new streamlined Media Manager which makes image insertion easy and image gallery making super easy. To make you feel right at home, here I will show you some tweaks that you can use to customize the new Media Upload box.
wordpress 3.5 media manager

Remove Default Tabs in WordPress Media Manager

With this code you can remove any unwanted Tab or link in the Media Manager:

add_filter( 'media_view_strings', 'custom_media_uploader' );
function custom_media_uploader( $strings ) {
    unset( $strings['selected'] ); //Removes Upload Files & Media Library links in Insert Media tab
    unset( $strings['insertMediaTitle'] ); //Insert Media
    unset( $strings['uploadFilesTitle'] ); //Upload Files
    unset( $strings['mediaLibraryTitle'] ); //Media Library
    unset( $strings['createGalleryTitle'] ); //Create Gallery
    unset( $strings['setFeaturedImageTitle'] ); //Set Featured Image
    unset( $strings['insertFromUrlTitle'] ); //Insert from URL
    return $strings;
}

Keep those strings that you want to remove, then add the code to your theme’s functions.php file.

If you prefer a cut down version of the Media Manager which allows only upload or selecting a file from the media library, then you can remove all those tab items to get a simple minimal look.

Add Custom Tab in WordPress Media Manager

After removing unnecessary tabs and links, if you want, you can add your own new custom tab for a new media file type or a plugin your’re making. For adding a new tab we’ll use media_upload_tabs filter. It’s the same filter that was used to add tabs in the old thickbox media box. media_upload_tabs filter is still well supported in WordPress, so you can count on it for the future.

So here’s the code:

function custom_media_upload_tab_name( $tabs ) {
    $newtab = array( 'tab_slug' => 'Your Tab Name' );
    return array_merge( $tabs, $newtab );
}

add_filter( 'media_upload_tabs', 'custom_media_upload_tab_name' );

function custom_media_upload_tab_content() {
    // Add you content here.
}
add_action( 'media_upload_tab_slug', 'custom_media_upload_tab_content' );

This will create a new tab in the Media Manager. Add the code you want to use in custom_media_upload_tab_content() function.


Tweet

Related posts:

  • Add Custom Media Type Filters in WordPress Media Library
  • Remove and Reorder Menu/Submenu Links in WordPress Dashboard
  • Add, Disable & Use Custom Image Sizes in WordPress 3.3 Media Uploader
  • Remove Website and Email Fields from WordPress Comment form
  • Increase Number of Recently Closed Tabs Firefox Can Restore
Categories: Tips 'n Tricks | Tags: WordPress
Add Google Drive in Office 2013 as a Cloud Storage Service
Adobe Reader: Change Text, Background Color for Eye-Friendly Reading

  • Get Updates via Email

  • Recent Posts

    • CMS2CMS: Migrate Site from Drupal or Joomla to WordPress
    • WordPress: Add Preview Button in Distraction Free Writing
    • How to Activate or Deactivate Individual Jetpack Modules
    • Windows 8: Auto Update Defender with Windows Update Disabled
    • Automatically Start and Close Programs at Specific Time
    • How to Copy Code from Notepad++ with Syntax Highlighting
  • Random Posts

    • New Gmail Labs Feature: Auto-advance
    • Find Disks, Partitions, and Volumes Size in Windows 8
    • Blogger Blogs Gets Mobile Friendly
    • Schedule Google Analytics to Email Website Performance Report
    • Get Back White Google Navigation Bar, or Customize it to Any Color of your Choice
    • 5 Free Tools to Keep All Your Software Updated
  • Categories

    • Blogging
    • Games
    • Google
    • How To?
    • Linux
    • Microsoft
      • Windows
    • Miscellaneous
    • Phone
    • Snippets
      • AutoHotkey Snippets
      • CSS Snippets
      • htaccess Snippets
      • JavaScript Snippets
      • PowerShell Snippets
      • WordPress Snippets
    • Social
    • Software
      • Browsers
    • Tips 'n Tricks
    • Wallpapers
    • Web
© SumTips. Contact | Sitemap | Privacy Policy