3

http://adambrown.info/p/wp_hooks/hook/plugin_action_links_%7B$plugin_file%7D

Says the hook is deprecated. However, the {$prefix}plugin_action_hook_{$plugin_file} is not. I poked around the wp-admin/includes/class-wp-plugins-list-table.php file for the hook, and found this:

$actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );

$prefix is defined a few lines above:

$prefix = $screen->is_network ? 'network_admin_' : '';

Since I was able to get my add_filter call to plugin_actions_row_{$plugin_file} to work, I'm assuming the filter hook is still there. Well, sort of: the filter is still available as it's not a network admin screen. Correct? And one could use...

add_filter( 'network_admin_plugin_action_links_{$plugin_file}', 'do_something' )

...to put a link into the network's plugin screen?

2 Answers 2

9

Yes, both should work as expected:

"plugin_action_links_{$plugin_file}"

"network_admin_plugin_action_links_{$plugin_file}"

Note that I'm using " instead of '.

PS: The term is deprecated, not depreciated.

2
  • 4
    "The term is deprecated, not depreciated" Phew, I thought the filter had lost value ;) Commented Jun 18, 2011 at 11:06
  • 1
    Whoa, I've been misreading that one for a long time now. Thanks! Commented Jun 18, 2011 at 13:30
0

This should be backward compatible and error free

"{$prefix}plugin_action_links_{$plugin_file}"
2
  • This answer would greatly increase in quality if you made it clear as to how it's different from the original answer. Also, what is $prefix? Commented May 7, 2013 at 8:42
  • Tough to answer that. It's been a long time. The main difference is {$prefix} but it seems the author of the question has answered that. It removes the warning from wordpress in debug mode and makes the program work even if $prefix is changed to something else other than ''. You have to understand that this hook isn't a part of the official wordpress api so it's best to hook into it the same way native wordpress code does so your code won't have issues in the future.
    – mAsT3RpEE
    Commented Nov 2, 2013 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.