The admin_head-media-upload-popup WordPress PHP action fires when scripts enqueued for the admin header for the legacy (pre-3.5.0) media upload popup are printed.
Usage
add_action('admin_head-media-upload-popup', 'your_function_name');
function your_function_name() {
// your custom code here
}
Parameters
This action does not accept any parameters.
More information
See WordPress Developer Resources: admin_head-media-upload-popup
Examples
Add custom CSS to the legacy media upload popup
Add custom CSS styles to the legacy media upload popup.
add_action('admin_head-media-upload-popup', 'add_custom_css_to_legacy_popup');
function add_custom_css_to_legacy_popup() {
echo '<style>
.custom-class {
background-color: #f00;
}
</style>';
}
Add custom JavaScript to the legacy media upload popup
Add custom JavaScript code to the legacy media upload popup.
add_action('admin_head-media-upload-popup', 'add_custom_js_to_legacy_popup');
function add_custom_js_to_legacy_popup() {
echo '<script>
// Custom JavaScript code
</script>';
}
Remove specific button from legacy media upload popup
Remove a specific button from the legacy media upload popup.
add_action('admin_head-media-upload-popup', 'remove_specific_button_from_legacy_popup');
function remove_specific_button_from_legacy_popup() {
echo '<style>
#button-id {
display: none;
}
</style>';
}
Change the logo of the legacy media upload popup
Change the logo displayed in the legacy media upload popup.
add_action('admin_head-media-upload-popup', 'change_legacy_popup_logo');
function change_legacy_popup_logo() {
echo '<style>
#header-logo {
background-image: url("your-logo-url");
}
</style>';
}
Modify the layout of the legacy media upload popup
Modify the layout of the legacy media upload popup, for example, by changing the padding and margins.
add_action('admin_head-media-upload-popup', 'modify_legacy_popup_layout');
function modify_legacy_popup_layout() {
echo '<style>
.media-upload-form {
padding: 20px;
margin: 10px;
}
</style>';
}