WAIT: Bricks doesn't recognize changed image sizes / names settings (update)

Hi!
I had defined some image sizes + names in functions.php that I would like to change.
Unfortunately, Bricks ignores these new settings.

Even if I install a completely new child theme and reset all settings in Bricks, the image sizes defined at the very beginning are retained.

Bildschirmfoto 2024-02-09 um 12.46.58

Is there a way to reset these image size settings somewhere so that Bricks takes the newly defined image sizes and names into account? Is there a kind of cache or an field in the database I have to delete?

EDIT:
Other threads which reported about this problem:

EDIT 2:
I have now deleted all Bricks settings in the database using an SQL command, only after then my settings were applied.
So this problem is solved but there is a second one:

The filter “image_size_names_choose” is included too early if Bricks was included as a template (then the new user-defined sizes do not yet exist). So WordPress can’t map them to the user-defined names and they are not displayed in the dropdown in Gutenberg:
Bildschirmfoto 2024-02-10 um 12.56.56

If you choose an regulär WordPress theme the custom names are recognized:
Bildschirmfoto 2024-02-10 um 12.58.18

Thanks
Jugibur

Hi JĂĽrgen,
Sorry for the late reply!

We are not 100% sure if we understand your report correctly, but this filter will probably solve your problem:

Hi timmse,

thanks for your reply! I have now set up a whole fresh installation with a Bricks child theme and tested various things. I used the standard WordPress image settings for the tests for the time being. Changes were only made in functions.php.
It confirms the issues described above.


Test #1: Trying to unset Images via “image_size_options”:

add_filter('bricks/builder/image_size_options', function ($image_sizes) {
  // Unset thumbnail, 1536x1536, 2048x2048
  unset($image_sizes['thumbnail']);
  unset($image_sizes['1536x1536']);
  unset($image_sizes['2048x2048']);

  return $image_sizes;
});

After that, I have done a force refresh and opened the image size settings in Bricks again,
Bildschirmfoto 2024-02-15 um 08.55.09

Result: The image sizes marked with “unset()” can also still be selected.


Test #2: Renaming an existing (WP standard) image size via “image_size_names_choose”:

add_filter('image_size_names_choose', function ($sizes) {
  return array_merge($sizes, array(
    'medium'         => 'Test title for medium width',
  ));
});

Result: WordPress / Gutenberg takes my individual title into account:
Bildschirmfoto 2024-02-15 um 09.03.47

But in Bricks, everything stays the same after a refersh:
Bildschirmfoto 2024-02-15 um 09.01.47


Test #3: Adding an individual image size with own title / name:

add_theme_support('post-thumbnails');

add_image_size("test-size", 555,  555);

add_filter(
  'image_size_names_choose',
  function ($size_names) {
    $new_sizes = array(
      'test-size' => 'Title for Test Sizes 555',
    );
    return array_merge($size_names, $new_sizes);
  }
);

Result: The individual title (“Title for Test Sizes 555”) isn’t shown up in the image sizes settings, just the upper case array key:
Bildschirmfoto 2024-02-15 um 09.37.11

and in Gutenberg the same issue:
Bildschirmfoto 2024-02-15 um 09.36.08

BUT:
The fact that everything was declared correctly in the Bricks child theme shows that the individual title is displayed correctly when you change the child theme with this code in the functions.php, i.e. the “Twenty Twenty-Four” theme:
Bildschirmfoto 2024-02-15 um 09.34.11

Of course after changing the image sizes, I always ran “wp media regenerate” via the WP CLI.

I have created an export package of my test suite with LocalWP (including access data) and uploaded it here if you want to test it yourself:

Thanks!
JĂĽrgen