• Resolved zz298

    (@zz298)


    Wondering if someone can help me. I’d like to remove the option to “Insert from URL” from the media upload window. The following functions.php code worked to remove the “From URL” tab up to 3.4, however it no longer works in 3.5:

    <?php function remove_media_url_tab($tabs) {
        unset($tabs['type_url']);
        return $tabs;
    }
    add_filter('media_upload_tabs', 'remove_media_url_tab', 99);
    ?>

    Is there a new way to do this in 3.5? Couldn’t find anything about it in the documentation.

    Any help would be appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Wondering the same thing. Let me know if you come up with anything. I wish they would have at least tagged those links with an ID so I can hide them with CSS.

    Figured it out… now to try and remove the media tab, try this:

    function remove_media_tab($strings) {
    
    	unset($strings["insertFromUrlTitle"]);
    	return $strings;
    }
    add_filter('media_view_strings','remove_media_tab');

    The rest of the strings, so far the media tab does some odd things when it’s removed:

    $strings = array(
    		// Generic
    		'url'         => __( 'URL' ),
    		'addMedia'    => __( 'Add Media' ),
    		'search'      => __( 'Search' ),
    		'select'      => __( 'Select' ),
    		'cancel'      => __( 'Cancel' ),
    		/* translators: This is a would-be plural string used in the media manager.
    		   If there is not a word you can use in your language to avoid issues with the
    		   lack of plural support here, turn it into "selected: %d" then translate it.
    		 */
    		'selected'    => __( '%d selected' ),
    		'dragInfo'    => __( 'Drag and drop to reorder images.' ),
    
    		// Upload
    		'uploadFilesTitle'  => __( 'Upload Files' ),
    		'uploadImagesTitle' => __( 'Upload Images' ),
    
    		// Library
    		'mediaLibraryTitle'  => __( 'Media Library' ),
    		'insertMediaTitle'   => __( 'Insert Media' ),
    		'createNewGallery'   => __( 'Create a new gallery' ),
    		'returnToLibrary'    => __( '← Return to library' ),
    		'allMediaItems'      => __( 'All media items' ),
    		'noItemsFound'       => __( 'No items found.' ),
    		'insertIntoPost'     => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
    		'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
    		'warnDelete' =>      __( "You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete." ),
    
    		// From URL
    		'insertFromUrlTitle' => __( 'Insert from URL' ),
    
    		// Featured Images
    		'setFeaturedImageTitle' => __( 'Set Featured Image' ),
    		'setFeaturedImage'    => __( 'Set featured image' ),
    
    		// Gallery
    		'createGalleryTitle' => __( 'Create Gallery' ),
    		'editGalleryTitle'   => __( 'Edit Gallery' ),
    		'cancelGalleryTitle' => __( '← Cancel Gallery' ),
    		'insertGallery'      => __( 'Insert gallery' ),
    		'updateGallery'      => __( 'Update gallery' ),
    		'addToGallery'       => __( 'Add to gallery' ),
    		'addToGalleryTitle'  => __( 'Add to Gallery' ),
    		'reverseOrder'       => __( 'Reverse order' ),
    	);
    Thread Starter zz298

    (@zz298)

    Thank you! This worked perfectly. Appreciate the extra info as well!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing "Insert from URL" in 3.5’ is closed to new replies.