Last active
July 22, 2021 23:53
-
-
Save heyjones/cba39377057765a7dc058b122ca5b8e9 to your computer and use it in GitHub Desktop.
This file contains 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 | |
namespace heyjones\wp_image_sizes; | |
add_action( 'after_setup_theme', __NAMESPACE__ . '\\after_setup_theme' ); | |
function after_setup_theme() { | |
$sizes = array( | |
'thumbnail' => array( | |
'size_w' => 360, | |
'size_h' => 360, | |
), | |
'medium' => array( | |
'size_w' => 720, | |
'size_h' => 9999, | |
), | |
'medium_large' => array( | |
'size_w' => 1080, | |
'size_h' => 9999, | |
), | |
'large' => array( | |
'size_w' => 1440, | |
'size_h' => 9999, | |
), | |
); | |
foreach( $sizes as $size => $options ) { | |
foreach( $options as $key => $val ) { | |
$option = sprintf( '%s_%s', $size, $key ); | |
if( $val !== get_option( $option ) ) { | |
update_option( $option, $val ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment