Multisite and Default Settings?
-
I’m planning to install this on a multisite network. However, by default all thumbnail sizes are set to display.
Is there a way of hiding certain image sizes by default?
I’m assuming something could be done to automatically inject a site option with an array of the image sizes to show? Looking in the database I can see I get the following:
a:2:{s:16:"pte_hidden_sizes";a:7:{i:0;s:16:"tiny-thumb-image";i:1;s:11:"small-thumb";i:2;s:15:"full-page-image";i:3;s:14:"featured-image";i:4;s:10:"team-image";i:5;s:12:"driver-image";i:6;s:18:"driver-small-image";}s:12:"cache_buster";b:0;}I’ve managed to get the following together, but it’s not quite working…
add_action('admin_init', 'confweb_set_pte_defaults' ); function confweb_set_pte_defaults(){ if ( !is_plugin_active( 'post-thumbnail-editor/post-thumbnail-editor.php' ) ) return; $pte_hidden_sizes = get_option('pte-site-options'); if(!empty($pte_hidden_sizes)) return; $pte_hidden_sizes = array(); $image_sizes = get_intermediate_image_sizes(); foreach ($image_sizes as $size_name => $size_attrs): $pte_hidden_sizes['pte_hidden_sizes'][] = $size_attrs; endforeach; $pte_hidden_sizes['cache_buster'] = ''; update_option( 'pte-site-options', serialize($pte_hidden_sizes) ); }At the moment I’m just trying to get all the sizes marked as hidden, then I can adjust as required to show the ones I’m after. However at this stage it’s not doing the job.
Any ideas?
The topic ‘Multisite and Default Settings?’ is closed to new replies.