WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Removing "Insert from URL" in 3.5 (5 posts)

  1. zz298
    Member
    Posted 1 year ago #

    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!

  2. consumedesign
    Member
    Posted 1 year ago #

    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.

  3. consumedesign
    Member
    Posted 1 year ago #

    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');
  4. consumedesign
    Member
    Posted 1 year ago #

    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' ),
    	);
  5. zz298
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic