Title: Undefined array key &#8220;deactivate&#8221;
Last modified: November 9, 2023

---

# Undefined array key “deactivate”

 *  Resolved [abazeed](https://wordpress.org/support/users/abazeed/)
 * (@abazeed)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/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.
 *     ```wp-block-code
       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:
 *     ```wp-block-code
       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'] )`:
 *     ```wp-block-code
       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,

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [David Aguilera](https://wordpress.org/support/users/davilera/)
 * (@davilera)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-deactivate/#post-17190445)
 * Well, if you click on our plugin’s _Deactivate_ action, you’ll see it actually
   opens a popup asking what kind of deactivation you want to run. So, if your goal
   is to prevent deactivating/deleting a plugin by mistake, I’d say ours is already
   covered by this popup, isn’t it? That is, you can simply skip this step in our
   plugin.
 * Now, if you’re wondering why we did that, it’s pretty simple: if you do want 
   to delete the plugin, you might also want to remove all the data we have from
   our cloud (and perhaps even cancel your subscription) – the popup allows you 
   to either do that or simply deactivate the plugin.
 * Be it as it may, we’ll add the extra check you proposed as well in the future
   release.
 *  Thread Starter [abazeed](https://wordpress.org/support/users/abazeed/)
 * (@abazeed)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-deactivate/#post-17190713)
 * Thank you [@davilera](https://wordpress.org/support/users/davilera/) for your
   kind and detailed response, and I appreciate your understanding!
 * Thank you again!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Undefined array key “deactivate”’ is closed to new replies.

 * ![](https://ps.w.org/nelio-content/assets/icon-256x256.png?rev=3356097)
 * [Nelio Content - Editorial Calendar & Social Media Auto-Posting](https://wordpress.org/plugins/nelio-content/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nelio-content/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nelio-content/)
 * [Active Topics](https://wordpress.org/support/plugin/nelio-content/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nelio-content/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nelio-content/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [abazeed](https://wordpress.org/support/users/abazeed/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-deactivate/#post-17190713)
 * Status: resolved