How to define the slug for my custom plugin?


I have created a custom plugin. How do I define its slug?

To clarify, if I attach a custom PHP function to the manage_plugins_custom_column hook, and in that function print the value of the $plugin_data array for each plugin in my WordPress installation, that array will contain information about each plugin. Here is such a function:

function opn_render_date( $column_name, $plugin_file, $plugin_data ) {
  error_log( print_r( $plugin_data, true ) );
add_action( 'manage_plugins_custom_column', 'opn_render_date', 10, 3 );

And here is example output for one popular plugin in the WordPress repo (Classic Editor). In that output, the array element $plugin_data['slug'] => classic-editor can be seen. I have created a plugin, installed it, and activated it. The plugin functions as expected. But when I print out the same $plugin_data[] for my plugin, $plugin_data['slug'] does not exist. Why is that? How do I define the slug for my plugin?

If the issue is related to the header in my main plugin PHP file, that header can be seen here.

Maybe a slug is assigned by WordPress, only after a plugin is accepted to the WordPress plugin repo? I have not yet submitted it there.

edit: To clarify, I’ve written a plugin that is installed/activated via Dashboard–>Plugins.

, , cag8f 3 years 2019-09-16T09:22:07-05:00 0 Answers 82 views 0

Leave an answer