Using WordPress ‘admin_print_styles-media-upload-popup’ PHP action

The admin_print_styles-media-upload-popup WordPress PHP action fires when admin styles are enqueued for the legacy (pre-3.5.0) media upload popup.

Usage

add_action('admin_print_styles-media-upload-popup', 'your_custom_function');
function your_custom_function() {
    // your custom code here
}

Parameters

  • None

More information

See WordPress Developer Resources: admin_print_styles-media-upload-popup

Examples

Enqueue Custom CSS for the Legacy Media Upload Popup

Enqueue a custom CSS file for styling the legacy media upload popup.

add_action('admin_print_styles-media-upload-popup', 'enqueue_custom_legacy_media_css');
function enqueue_custom_legacy_media_css() {
    wp_enqueue_style('custom-legacy-media-css', get_template_directory_uri() . '/css/custom-legacy-media.css');
}

Inline Custom CSS for the Legacy Media Upload Popup

Add inline custom CSS to the legacy media upload popup.

add_action('admin_print_styles-media-upload-popup', 'inline_custom_legacy_media_css');
function inline_custom_legacy_media_css() {
    echo '<style>
        .some-class { color: red; }
    </style>';
}

Change Background Color of the Legacy Media Upload Popup

Change the background color of the legacy media upload popup to a light gray.

add_action('admin_print_styles-media-upload-popup', 'change_legacy_media_popup_bg');
function change_legacy_media_popup_bg() {
    echo '<style>
        body { background-color: #f5f5f5; }
    </style>';
}

Hide Certain Elements in the Legacy Media Upload Popup

Hide specific elements in the legacy media upload popup using CSS.

add_action('admin_print_styles-media-upload-popup', 'hide_elements_legacy_media_popup');
function hide_elements_legacy_media_popup() {
    echo '<style>
        .element-to-hide { display: none; }
    </style>';
}

Customize Button Styles in the Legacy Media Upload Popup

Customize the button styles within the legacy media upload popup.

add_action('admin_print_styles-media-upload-popup', 'customize_buttons_legacy_media_popup');
function customize_buttons_legacy_media_popup() {
    echo '<style>
        .button { background-color: #0073aa; border-color: #0073aa; color: #ffffff; }
        .button:hover { background-color: #0083cb; border-color: #0083cb; color: #ffffff; }
    </style>';
}