[wp-trac] [WordPress Trac] #33415: WP_Customize_Media_Control mime_type parameter
WordPress Trac
noreply at wordpress.org
Wed Aug 19 00:42:22 UTC 2015
#33415: WP_Customize_Media_Control mime_type parameter
----------------------------+-----------------------------
Reporter: IstanbulMMV | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.3
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
The WP_Customize_Media_Control mime_type parameter filters media modal
output correctly but still enables the user to upload a file type that
does not meet the mine_type stipulation.
Example code:
{{{
function site_logo_customizer_control( $wp_customize ) {
$wp_customize->add_setting( 'custom_site_logo', array(
'sanitize_callback' => 'absint',
'type' => 'option',
) );
$wp_customize->add_control( new WP_Customize_Media_Control(
$wp_customize, 'custom_site_logo', array(
'section' => 'title_tagline',
'settings' => 'custom_site_logo',
'label' => __( 'Site Logo' ),
'mime_type' =>
array('image/jpeg','image/gif','image/png'),
'priority' => 30,
) ) );
}
add_action( 'customize_register', 'site_logo_customizer_control' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33415>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list