On this page
_device_can_upload(): bool
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Tests if the current device has the capability to upload files.
Return
bool Whether the device is able to upload files.
Source
File: wp-includes/functions.php. View all references
function _device_can_upload() {
if ( ! wp_is_mobile() ) {
return true;
}
$ua = $_SERVER['HTTP_USER_AGENT'];
if ( strpos( $ua, 'iPhone' ) !== false
|| strpos( $ua, 'iPad' ) !== false
|| strpos( $ua, 'iPod' ) !== false ) {
return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
}
return true;
}
Related
Uses
| Uses | Description |
|---|---|
| wp_is_mobile() wp-includes/vars.php | Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
Used By
| Used By | Description |
|---|---|
| media_upload_form() wp-admin/includes/media.php | Outputs the legacy media upload form. |
| wp_plupload_default_settings() wp-includes/media.php | Prints default Plupload arguments. |
| wp_print_media_templates() wp-includes/media-template.php | Prints the templates used in the media manager. |
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_device_can_upload