Skip to content

Fix: Clear theme cache after adding extra_theme_headers#495

Open
CookieDarb wants to merge 1 commit into
WordPress:masterfrom
CookieDarb:fix/active-theme-license-headers
Open

Fix: Clear theme cache after adding extra_theme_headers#495
CookieDarb wants to merge 1 commit into
WordPress:masterfrom
CookieDarb:fix/active-theme-license-headers

Conversation

@CookieDarb

Copy link
Copy Markdown

What?

Closes #494

This PR ensures that the "License" and "License URI" fields are correctly displayed in the Theme Info summary box when checking the currently active theme.

Why?

When Theme Check is run against the currently active theme, the "License" and "License URI" fields are missing from the visual summary box at the top of the WP Admin page. This occurs because WordPress caches the active theme's WP_Theme object early during initialization, long before Theme Check hooks into the extra_theme_headers filter to register these license fields.

How?

This PR:

  1. Adds a call to wp_clean_themes_cache( false ); immediately after registering the extra_theme_headers filter in theme-check.php.
  2. This busts the WordPress theme cache and forces wp_get_theme() to re-parse the active theme, successfully capturing the new headers.

Testing Instructions

  1. Activate a theme on your site that has License: and License URI: defined in its style.css
  2. Navigate to Appearance > Theme Check.
  3. Select the currently active theme from the dropdown and click Check it!.
  4. Look at the Theme Info summary box at the top of the results page.
  5. Verify that both the License and License URI fields are now correctly displayed in the summary box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: "License" and "License URI" are missing from Theme Info summary when checking the active theme

1 participant