WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.5k stars 4.19k forks source link

New or changed patterns on a fluid theme do not show in the block search #65335

Closed margarita-boomCodes closed 1 month ago

margarita-boomCodes commented 1 month ago

Description

As of WP 6.6, the pattern metadata, such as title and slug, are being saved into a transient (_site_transient_wp_theme_files_patterns-xxxx). The problem is that this transient isn't updated, when the metadata of a pattern file unter the patterns directory, changes or a new file is added. Interestingly, the transient will be updated, when a pattern file is deleted.

The expected behavior would be to update the transient when a file is changed, added or deleted.

Step-by-step reproduction instructions

  1. Activate the Emptytheme fluid theme (This should create also the transient)
  2. Create a patterns directory and add a new pattern
  3. Search the pattern in the library (the new pattern is not visible)
  4. Delete the _site_transient_wp_theme_files_patterns-xxxx on the database's options table.
  5. Search the pattern in the library (the new pattern is now visible)

Screenshots, screen recording, code snippet

No response

Environment info

Please confirm that you have searched existing issues in the repo.

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Mamaduka commented 1 month ago

Adding define( 'WP_DEVELOPMENT_MODE', 'theme' ); should resolve the issue when developing themes.

You can read more about developing modes here: https://make.wordpress.org/core/2023/07/14/configuring-development-mode-in-6-3/.

t-hamano commented 1 month ago

This issue was also reported in #64173, and I believe it is expected behavior, so I would like to close it.

margarita-boomCodes commented 1 month ago

Adding define( 'WP_DEVELOPMENT_MODE', 'theme' ); should resolve the issue when developing themes.

You can read more about developing modes here: https://make.wordpress.org/core/2023/07/14/configuring-development-mode-in-6-3/.

@Mamaduka Since the WP_DEVELOPMENT_MODE should not be used in production environment, I think this solution to increase the theme version number, could be more appropriate (even though not ideal)