Skip to content

[Bug]: Global Media tab doesn't show outside posts #142

Description

@uprise10

Description of the bug

However this is somehow intended, I somehow see this this as a bug, since the Global Media tab is only showed when editing posts.

When you want to use global media on other places (like custom options pages, or even ACF option pages), the script for the tab is not loading.

That is because of this lines in enqueueScripts():

if ('post' !== get_current_screen()->base) {
    return;
}

What is the reason behind it and can this be removed, or at least being overridden through a filter?

When just removing these lines it seems to work great, so I don't understand this choice? But probably there is one, so I'm curious :-)

PS: same goes for the CSS file, of course :-)

Reproduction instructions

  1. Use, for example, and ACF options page, or any other page outside an edit-post page
  2. Add a media field and click the "Add Media" button
  3. No "Global Media" tab will show

Expected behavior

I'd expect that the tab is visible for any "Add Media" button everywhere in the backend.

Environment info

  • Version 0.2.0

Relevant log output

No response

Additional context

When just removing the get_current_screen() check it works. So adding a filter for that at least would be very great.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions