Support » Plugin: Regenerate Thumbnails » Regenerate by Month Uploaded

  • Hi,

    I am currently resizing my clients images and regenerating them as I complete a month, is there any way to select just the whole month for example May 2020?

    I am currently doing 400 at a time but it would be handy to just do all in that month at a time.

    Is this possible?

    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author Renatho

    (@renathoc)

    Hey @mattm3 !

    There is not a configurable solution, but there is a “hacky” solution that you could use. Each time you need to regenerate the thumbnails, you can temporarily add this filter to your site, so it will filter your attachments based on the dates you set.

    add_filter( 'rest_attachment_query', function( $args, $request ) {
    	if ( empty( $request['is_regeneratable'] ) ) {
    		return $args;
    	}
    
    	$args['date_query'] = [
    		'column' => 'post_date',
    		'after' => '2020-12-01',
    		'before' => '2020-12-30'
    	];
    
    	return $args;
    }, 10, 2 );

    I hope it can help you! 🙂

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.