Skip to content

Instantly share code, notes, and snippets.

@richaber
Created June 27, 2022 15:18
Show Gist options
  • Save richaber/c4c16c928918c55f8434924cce5ee14f to your computer and use it in GitHub Desktop.
Save richaber/c4c16c928918c55f8434924cce5ee14f to your computer and use it in GitHub Desktop.
wp_get_registered_image_subsizes() example var dump

Array shape returned by wp_get_registered_image_subsizes().

https://developer.wordpress.org/reference/functions/wp_get_registered_image_subsizes/

<?php

$registered_image_sizes = wp_get_registered_image_subsizes();

$registered_image_sizes = [
    'thumbnail'    => [
        'width'  => 150,
        'height' => 150,
        'crop'   => true,
    ],
    'medium'       => [
        'width'  => 300,
        'height' => 300,
        'crop'   => false,
    ],
    'medium_large' => [
        'width'  => 768,
        'height' => 0,
        'crop'   => false,
    ],
    'large'        => [
        'width'  => 1024,
        'height' => 1024,
        'crop'   => false,
    ],
    '1536x1536'    => [
        'width'  => 1536,
        'height' => 1536,
        'crop'   => false,
    ],
    '2048x2048'    => [
        'width'  => 2048,
        'height' => 2048,
        'crop'   => false,
    ],
    'custom_1'     => [
        'width'  => 340,
        'height' => 255,
        'crop'   => true,
    ],
    'custom_2'     => [
        'width'  => 306,
        'height' => 261,
        'crop'   => true,
    ],
    'custom_3'     => [
        'width'  => 612,
        'height' => 522,
        'crop'   => true,
    ],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment