Use TextDomain as slug for single-file plugins#93
Open
apermo wants to merge 1 commit intoZodiac1978:developfrom
Open
Use TextDomain as slug for single-file plugins#93apermo wants to merge 1 commit intoZodiac1978:developfrom
apermo wants to merge 1 commit intoZodiac1978:developfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TextDomainheader as the slug instead of the filenamehello.php) being reported as "not found" — its TextDomainhello-dollymatches the wp.org slug, while the filename-derivedhellodoes notFixes #78
Context
get_plugin_slug()derives the slug from the plugin's file path. Forplugin-name/plugin-name.php, the directory name matches the wp.org slug. But single-file plugins likehello.phphave no directory — the code strips the extension to gethello, which doesn't match the actual wp.org slughello-dolly.The
TextDomainheader 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