The admin_viewport_meta WordPress PHP filter allows you to modify the viewport meta in the WordPress admin area.
Usage
add_filter('admin_viewport_meta', 'custom_admin_viewport_meta'); function custom_admin_viewport_meta($viewport_meta) { // your custom code here return $viewport_meta; }
Parameters
$viewport_meta
(string) – The current viewport meta value.
More information
See WordPress Developer Resources: admin_viewport_meta
Examples
Change viewport scale
Customize the viewport scale in the admin area to set the initial zoom level.
add_filter('admin_viewport_meta', 'custom_viewport_scale'); function custom_viewport_scale($viewport_meta) { $viewport_meta = 'width=device-width, initial-scale=1.2'; return $viewport_meta; }
Disable zooming
Disable zooming in the WordPress admin area by setting user-scalable to no.
add_filter('admin_viewport_meta', 'disable_zooming'); function disable_zooming($viewport_meta) { $viewport_meta = 'width=device-width, initial-scale=1, user-scalable=no'; return $viewport_meta; }
Set a fixed width
Set a fixed width for the WordPress admin area.
add_filter('admin_viewport_meta', 'fixed_width_admin'); function fixed_width_admin($viewport_meta) { $viewport_meta = 'width=1200'; return $viewport_meta; }
Increase minimum zoom level
Increase the minimum zoom level in the WordPress admin area.
add_filter('admin_viewport_meta', 'increase_min_zoom'); function increase_min_zoom($viewport_meta) { $viewport_meta = 'width=device-width, initial-scale=1, minimum-scale=1.5'; return $viewport_meta; }
Set maximum zoom level
Set a maximum zoom level for the WordPress admin area.
add_filter('admin_viewport_meta', 'set_max_zoom'); function set_max_zoom($viewport_meta) { $viewport_meta = 'width=device-width, initial-scale=1, maximum-scale=2'; return $viewport_meta; }