I am creating a child theme based on 2016

I want to set new upload media images

add_action( 'after_setup_theme', 'azm_add_image_size' );
function azm_add_image_size() {
  add_image_size( 'helen', 936 ); 
  add_image_size( 'brian', 227 ); 

add_filter( 'image_size_names_choose', 'my_custom_sizes' );
function my_custom_sizes( $sizes ) {
    return array_merge( $sizes, array(
       'helen' => __( 'helen' ),
        'brian' =>__( 'brian')
    ) );

The small size, brian, works fine.

However the large size is creating the correct image in the uploads folder eg 'bluehousefrontelevation-1-936x624.jpg'

however, in the backend the media library is showing helen-840x560 and it adds the wrong width/height sizes into the code.

I have tired suggestions at https://codex.wordpress.org/Content_Width and core ticket

Nothing seems to work.

The only way i can find to get round it is to edit the functions.php within 2016 - which obviously I don't really want to do - here's what i edit:

function twentysixteen_content_width() {
//  $GLOBALS['content_width'] = apply_filters( 'twentysixteen_content_width', 840 );
    $GLOBALS['content_width'] = apply_filters( 'twentysixteen_content_width', 2000 );
add_action( 'after_setup_theme', 'twentysixteen_content_width', 0 );

Is there are better way to change this (annoying) variable please?

1 Answer 1


Is there are better way to change this (annoying) variable please?

The Twenty Sixteen theme provides you with the twentysixteen_content_width filter, where the default is 840.

To modify it you should be able to use this within your child theme's functions.php file:

add_filter( 'twentysixteen_content_width', function( $content_width )
    // Override the default 840 content width
    $content_width = 2000;

    return $content_width; 
} );
  • great - thanks - I knew there had to be a way, I just couldn't find it. So thanks a million
    – maxelcat
    Jul 13, 2016 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.