Created
July 13, 2016 04:57
-
-
Save UmeshSingla/1b95a7e8b8c053bd6a5ea97531668c48 to your computer and use it in GitHub Desktop.
WP Smush: Allows to filter the resize dimensions for a specific admin role
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wp_smush_resize_sizes', 'filter_resize_dimesnsion' ); | |
function filter_resize_dimension( $dimensions ) { | |
$user = wp_get_current_user(); | |
if ( ! empty( $user ) && in_array( 'custom role', (array) $user->roles ) ) { | |
//The user has the "specific admin" role, modify the dimensions | |
$dimensions = array( | |
'width' => 1440, | |
'height' => 1440 | |
); | |
} | |
//return the dimensions | |
return $dimensions; | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment