I’ve written a plugin, but WordPress does not recognize that it has a slug. How
-
TL;DR I’ve written a plugin, and can activate and use my plugin. But WordPress does not recognize that it has a slug. Why is that?
___
Hi all. I’ve written my first plugin–a very simple single-file plugin. WordPress recognizes the plugin, and the code in the plugin executes as expected. But I am having trouble getting WordPress to recognize that it has a slug. When I use themanage_plugins_custom_column
hook, and print its$plugin_data
input parameter, it prints the slug for all my installed plugins *except* the plugin I have written. Why doesn’t WordPress recognize that my plugin has a slug?I realize my slug *should* be identical to the name of the folder that houses my plugin. That name is
outdated-plugin-notifier
. But my issue is that WordPress doesn’t register anything at all as my slug–it doesn’t even seem to define theslug
variable (see below).To give more details, here is what I have done so far. If I attach a function to the
manage_plugins_custom_column
hook, and in that function print the value of its$plugin_data
input parameter, the data for all my installed plugins is printed. I currently have only two plugins installed: my plugin, and the popular Classic Editor plugin. For the Classic Editor plugin, the$plugin_data
array contains significantly more information than that for my custom plugin–data like$plugin_data[slug]
and$plugin_data[URL]
are present for Classic Editor, but not for my plugin (screenshots). Why is my plugin missing all this data? You can see the full output here.To be clear, my plugin folder is named
outdated-plugin-notifier
and in it sits my plugin’s lone PHP file (outdated-plugin-notifier.php
). I was under the impression the plugin’s slug would automatically be assigned the same string as the folder name. I can activate my plugin without issue (no PHP errors), and it functions as expected, without issues. But WordPress thinks it has no slug, which turns out is actually vital to my plugin.The reason I need to ascertain the slug for my plugin is because my plugin needs to lookup information for every installed plugin, and it does so via the plugin’s slug.
If the issue is related my PHP file header, you can see that here.
Thanks in advance.
- The topic ‘I’ve written a plugin, but WordPress does not recognize that it has a slug. How’ is closed to new replies.