Skip to content

Use TextDomain as slug for single-file plugins#93

Open
apermo wants to merge 1 commit intoZodiac1978:developfrom
apermo:fix/single-file-plugin-slug
Open

Use TextDomain as slug for single-file plugins#93
apermo wants to merge 1 commit intoZodiac1978:developfrom
apermo:fix/single-file-plugin-slug

Conversation

@apermo
Copy link
Copy Markdown
Contributor

@apermo apermo commented Apr 13, 2026

Summary

  • For single-file plugins (no subdirectory), use the TextDomain header as the slug instead of the filename
  • Fixes Hello Dolly (hello.php) being reported as "not found" — its TextDomain hello-dolly matches the wp.org slug, while the filename-derived hello does not
  • Generic fix, not a Hello Dolly special case — works for any single-file plugin
  • Plugins in subdirectories are unaffected (directory name is still used)

Fixes #78

Context

get_plugin_slug() derives the slug from the plugin's file path. For plugin-name/plugin-name.php, the directory name matches the wp.org slug. But single-file plugins like hello.php have no directory — the code strips the extension to get hello, which doesn't match the actual wp.org slug hello-dolly.

The TextDomain header reliably matches the wp.org slug for virtually all plugins. Using it as the slug source for single-file plugins resolves the mismatch.

Test in WordPress Playground

Hello Dolly is bundled with WordPress, so no extra plugins needed to reproduce.

Before (develop — Hello Dolly shows "not found"): Open in WordPress Playground

After (this branch — Hello Dolly resolved correctly): Open in WordPress Playground

Pre-installed test plugins: Apermo Admin Bar (outdated) — Hello Dolly is bundled with WordPress.

Test plan

  • Open the Before link — Hello Dolly row shows "wordpress.org, plugin not found" and "No data available" everywhere
  • Open the After link — Hello Dolly row shows "wordpress.org" with correct version, last update, tested up to, and rating
  • Verify all other plugins still display correctly in the After link

For plugins in subdirectories, the directory name is used
as the slug — matching the wp.org convention. But single-
file plugins like hello.php derive slug 'hello' from the
filename, which doesn't match the wp.org slug 'hello-dolly'.

For single-file plugins, prefer the TextDomain header as
the slug, since it reliably matches the wp.org slug for
virtually all plugins.

Fixes Zodiac1978#78
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.

Edge Case: Hello Dolly

1 participant