WordPress Snippets at WPcustoms

Remove Plugin edit-delete Links

we are going to remove the edit link and remove the delete link on certain plugins.


/**
 * Snippet Name: Remove Plugin edit-delete Links
 * Snippet URL: https://wpcustoms.net/snippets/remove-plugin-edit-delete-links/
 */
  function wpc_remove_plugin_actions( $actions, $plugin_file, $plugin_data, $context ) 
{
	// Remove all the edit links
	if ( isset( $actions['edit'] ) )
	{
		unset( $actions['edit'] );
	}

	// Remove the deactivate link only from plugins in the switch
	if( isset( $actions['deactivate'] ) )
	{
		switch($plugin_file)
		{
			case 'hello.php':
			case 'disqus-comment-system/disqus.php':
				unset( $actions['deactivate'] );

			break;
		}
	}

	return $actions;
}
add_filter( 'plugin_action_links', 'wpc_remove_plugin_actions', 10, 4 );