• Is it possible to overwrite post thumbnail sizes set by add_image_size from a child theme (or more likely detect sizes already set and not overwrite them if found in the parent theme?)

    Functions need special immediate attention when creating parent themes since sites crash with duplicate function declarations, whereas add_image_size easily slips under the radar with the parent functions.php file being called after the child thereby overwriting sizes which I’d naturally like to take preference.

    Obviously the add_image_size declarations could be wrapped in a function in both the child and parent themes and the parent function only fired if the child function is not found, but unless this is done on an individual-size-per-function basis there’s no way of knowing which sizes have been written in which.

    I’m using the if(!foobar) function foobar type statements in the parent theme at the moment: can an equivalent be done with add_image_size?

Viewing 1 replies (of 1 total)
  • I don’t think you can remove/over-write add_image_size but you could check to see what additional images are already set:

    <?php
    global $_wp_additional_image_sizes;
    echo '<pre>';
    print_r($_wp_additional_image_sizes);
    echo '</pre>';
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘How to overwrite add_image_size in child theme’ is closed to new replies.