I’m developing a plugin and I’ve organized its code in separate files. The admin functions file is inside an /admin
subfolder. In this file I enqueue scripts and styles, add meta boxes and so on.
I’d like to add some action links to the installed plugins screen using the plugin_action_links_{$plugin_file}
hook, but I cannot get it to work.
As this hook is added outside the main plugin file this doesn’t work:
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'add_action_links' ) );
My question is, how can I get the plugin_basename()
of the main plugin file from a different file in a subfolder? Is it possible?
Thanks in advance