Size Shelf icon
Media, Galleries & Sliders

Size Shelf hooks reference

Size Shelf 1.0.1 has 6 actions and 15 filters, read directly from its source code on Nov 19, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when Size Shelf fires an action
add_action( 'size_shelf_before_item', function( $arg1, $job ) {
	// Your code runs here.
}, 10, 2 );

// Change a value Size Shelf is about to use
add_filter( 'image_size_names_choose', function( $defaults ) {
	// Change $defaults here.
	return $defaults;
}, 10, 1 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • includes/class-size-shelf-sizes.php line 269
    /**
     * This filter is documented in wp-admin/includes/media.php
     */
    apply_filters( 'image_size_names_choose', $defaults );
  • includes/class-size-shelf-sizes.php line 116
    /**
     * This filter is documented in wp-admin/includes/image.php
     */
    apply_filters( 'intermediate_image_sizes_advanced', self::registered(), $image_meta, $attachment_id );
  • includes/class-size-shelf-admin.php line 138
    /**
     * Filters the boot data of the admin app.
     */
    apply_filters( 'size_shelf_app_data', array( 'version' => SIZE_SHELF_VERSION, 'ids' => $ids, 'theme' => $theme->get( 'Name' ), 'uploadsUrl' => Size_Shelf_Files::baseurl(), 'mediaUrl' => admin_url( 'upload.php' ), 'editor' => self::editor_name(), 'multisite' => is_multisite(), 'maxTime' => (int) ini_get( 'max_execution_time' ), 'proUrl' => self::pro_url(), ) );
  • includes/class-size-shelf-admin.php line 118
    /**
     * Filters the dependencies of the admin app script (add-ons register their
     * scripts first).
     */
    apply_filters( 'size_shelf_app_dependencies', $asset['dependencies'] );
  • includes/class-size-shelf-rest.php line 292
    /**
     * Whether an add-on runs "background" jobs (without the browser stepping
     * them).
     */
    apply_filters( 'size_shelf_background_available', false );
  • includes/class-size-shelf-jobs.php line 327
    /**
     * Fires before a job works on one item.
     */
    do_action( 'size_shelf_before_item', (int) $item, $job );
  • includes/class-size-shelf-regenerator.php line 229
    /**
     * Fires before Size Shelf makes the sub-sizes of an image.
     */
    do_action( 'size_shelf_before_regenerate', $attachment_id, array_keys( $targets ), $mode );
  • includes/class-size-shelf-rest.php line 38
    /**
     * Filters the capability needed to use Size Shelf.
     */
    apply_filters( 'size_shelf_capability', 'manage_options' );
  • includes/class-size-shelf-cleanup.php line 333
    /**
     * Filters whether a size file counts as used somewhere (so cleanup keeps it).
     */
    apply_filters( 'size_shelf_file_in_use', (bool) $in_meta, $name );
  • includes/class-size-shelf-jobs.php line 85
    /**
     * Filters job arguments, so add-ons can accept extra scopes (e.g. a folder).
     */
    apply_filters( 'size_shelf_job_args', $clean, $args, $type );
  • includes/class-size-shelf-jobs.php line 561
    /**
     * Fires when a job completes.
     */
    do_action( 'size_shelf_job_done', $job );
  • includes/class-size-shelf-jobs.php line 490
    /**
     * Filters the attachment query of a regenerate or scan job (add-ons add scopes
     * here).
     */
    apply_filters( 'size_shelf_job_query_args', $args, $job );
  • includes/class-size-shelf-jobs.php line 187
    /**
     * Fires when a job starts.
     */
    do_action( 'size_shelf_job_started', $job );
  • includes/class-size-shelf.php line 42
    /**
     * Fires once Size Shelf has loaded. Add-ons hook in here.
     */
    do_action( 'size_shelf_loaded' );
  • includes/class-size-shelf-regenerator.php line 45
    /**
     * Filters the attachment mime types Size Shelf regenerates.
     */
    apply_filters( 'size_shelf_mime_types', $types );
  • includes/class-size-shelf-cleanup.php line 291
    /**
     * Filters the protected file names of an uploads folder.
     */
    apply_filters( 'size_shelf_referenced_files', $refs, $dir );
  • includes/class-size-shelf-regenerator.php line 251
    /**
     * Fires after Size Shelf regenerated an image.
     */
    do_action( 'size_shelf_regenerated', $attachment_id, $result, $meta );
  • includes/class-size-shelf-jobs.php line 119
    /**
     * Filters the scopes a regenerate or scan job accepts.
     */
    apply_filters( 'size_shelf_scopes', array( 'all', 'ids', 'dates' ) );
  • includes/class-size-shelf-cleanup.php line 184
    /**
     * Filters the regex used to recognise generated size files of an image.
     */
    apply_filters( 'size_shelf_size_file_pattern', '/^(?:' . implode( '|', array_unique( $bases ) ) . ')(?:-e\d{13})?-\d{1,5}x\d{1,5}(?:@2x)?\.(?:' . implode( '|', $exts ) . ')$/i', $attachment_id );
  • includes/class-size-shelf-sizes.php line 168
    /**
     * Filters the detected source of an image size.
     */
    apply_filters( 'size_shelf_size_source', $result, $name );

Generated from Size Shelf's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Done for you

Rather have it built for you?

Tell us what should change and we’ll write and test the code using these hooks.

Plugin customisation

from $149

New features or changed behaviour, without editing the plugin’s files.

  • Built as a companion plugin, so updates never wipe it
  • Exact quote before we start
  • Tested on staging, then deployed

Typical turnaround: 3–7 business days

Choose this

Not sure which fits? Describe what you need and we’ll suggest the simplest option.

Can't find the right hook?

We can build the customisation for you. Describe what you need: