Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media tab not working when video and audio uploads are disabled #46658

Closed
david-binda opened this issue Dec 19, 2022 · 1 comment
Closed

Media tab not working when video and audio uploads are disabled #46658

david-binda opened this issue Dec 19, 2022 · 1 comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Media Anything that impacts the experience of managing media [Type] Bug An existing feature does not function as intended

Comments

@david-binda
Copy link
Contributor

david-binda commented Dec 19, 2022

Description

The media tab added in 44918 is not being displayed in case audio and video files uploads are disabled.

The media types in WordPress can be limited (or extended) via upload_mimes filter. In case a plugin or a custom code is limiting the upload types to images only.

In case such code is in effect, the Gutenberg is producing JS errors as displayed on the screenshot below upon clicking on the Block inserter toggle and no media tab is being displayed.

IMHO, the code should not expect any media types to be allowed for upload, and only display the media tab for allowed media types, if there are any.

Step-by-step reproduction instructions

  1. Add the code for limiting the media types allowed to be uploaded to a mu-plugin on your test installation
  2. Go to new post screen
  3. Click on the Block inserter toggle

Screenshots, screen recording, code snippet

add_filter( 'upload_mimes', function( $mimes ) {
	return array_filter( $mimes, function( $type ) {
		return ( false !== strpos( $type, 'image' ) );
	} );
} );

Screenshot 2022-12-19 at 16 13 50

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@kathrynwp kathrynwp added [Feature] Media Anything that impacts the experience of managing media [Type] Bug An existing feature does not function as intended [Feature] Inserter The main way to insert blocks using the + button in the editing interface labels Dec 19, 2022
@ntsekouras
Copy link
Contributor

This should be fixed properly by: #46251. Feel free to reopen if you encounter any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Media Anything that impacts the experience of managing media [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants