Undefined array key “deactivate”
-
I’m using the filter
plugin_action_links
to remove the Deactivate/Delete links of all the plugins to avoid deactivating/deleting any by mistake, and using the Bulk actions menu to perform such actions.function unset_critical_plugins_action_links( $actions ) { unset( $actions['deactivate'] ); unset( $actions['delete'] ); return $actions; } add_filter( 'plugin_action_links', 'unset_critical_plugins_action_links' );
But you already use the filter
plugin_action_links_{$plugin_file}
to control the action links of your plugin, that’s why I keep getting this warning whenever I open the Plugins page:PHP Warning: Undefined array key "deactivate" in ..../wp-content/plugins/nelio-content/admin/pages/class-nelio-content-plugin-list-page.php on line 60
I tried to change my filter priority to make it run after yours, but it didn’t work.
Could you please add one more condition to your code (line
57
in the same file) to avoid this warning? Something like&& isset( $actions['deactivate'] )
:if ( current_user_can( 'deactivate_plugin', nelio_content()->plugin_file ) && isset( $actions['deactivate'] ) ) { $actions['deactivate'] = sprintf( '<span class="nelio-content-deactivate-link"></span><noscript>%s</noscript>', $actions['deactivate'] ); }//end if
I hope you consider this in your next release! ????
Best Regards,
- The topic ‘Undefined array key “deactivate”’ is closed to new replies.