Answers.Body: <p>You will need to enable it to uninstall it but you can do everything via CLI.</p>
  <p>First <code>./craft plugin/enable plugin-handle</code> then <code>./craft plugin/uninstall plugin-handle</code> then <code>composer remove namespace/package-name</code>.</p>
  <p>If you really can't enable it as above, you'd need to <code>composer remove namespace/package-name</code> and manually remove any references in your <code>plugins</code> table, project config as well as any tables the plugin may have created on install.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-03T19:40:29.670Z
Answers.Text: Thank you. After posting, it dawned on me that, as you mention, without enabling the plugin, it can't do its own cleanup upon uninstalling.
Answers.UserDisplayName: kr37
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-03T08:49:04.140Z
Answers.LastActivityDate: 2020-11-03T09:07:38.757Z
Answers.LastEditDate: 2020-11-03T09:07:38.757Z
Answers.UserDisplayName: Oli
Body: <p>I hadn't allowed Craft to update for a while, and then did, but it broke on a plugin, and I couldn't get into the CP. I figured out which plugin was causing the problem, it turned out I wasn't using it, so I disabled it in <code>craft/config/general.php</code> as follows:</p>
  <pre><code>return [
      '*' =&gt; [
          'disabledPlugins' =&gt; ['embedded-assets-link'],
      ],
  ];
  </code></pre>
  <p>That enabled me access to the CP, but, being disabled, I couldn't uninstall it through the CP, as explained <a href="https://craftcms.stackexchange.com/questions/26897/how-to-uninstall-a-plugin-when-there-is-no-cp-option?rq=1">here</a>.</p>
  <p>I tried many things, including</p>
  <ul>
  <li>remove references to the plugin in <code>craft/vendor/craftcms/plugins.php</code></li>
  <li>removed references to the plugin from <code>composer.json</code></li>
  <li>run <code>composer update</code></li>
  </ul>
  <p>and probably some other nonsense.</p>
  <p>So, having done it the hard way, I'd like to ask, is there a correct way to remove a plugin which cannot be enabled ('cause it's broken) ?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-03T08:35:13.860Z
Comments.Text: I think you can use one single command `composer remove vendor/package/name` as you have the access of SSH
Comments.UserDisplayName: inrsaurabh
Tags: <plugins><uninstall>
Title: What's the correct way to uninstall a plugin which MUST NOT be enabled?
ThreadText: # What's the correct way to uninstall a plugin which MUST NOT be enabled?
  
  (Asked by: username_0 on 2020-11-02)
  
  I hadn't allowed Craft to update for a while, and then did, but it broke on a plugin, and I couldn't get into the CP. I figured out which plugin was causing the problem, it turned out I wasn't using it, so I disabled it in `craft/config/general.php` as follows:
  
  ```
  return [
      '*' => [
          'disabledPlugins' => ['embedded-assets-link'],
      ],
  ];
  
  ```
  
  That enabled me access to the CP, but, being disabled, I couldn't uninstall it through the CP, as explained [here](https://craftcms.stackexchange.com/questions/26897/how-to-uninstall-a-plugin-when-there-is-no-cp-option?rq=1).
  
  I tried many things, including
  
  * remove references to the plugin in `craft/vendor/craftcms/plugins.php`
  * removed references to the plugin from `composer.json`
  * run `composer update`
  
  and probably some other nonsense.
  
  So, having done it the hard way, I'd like to ask, is there a correct way to remove a plugin which cannot be enabled ('cause it's broken) ?
  
  **Tags:** plugins, uninstall
  
  > **Comments:**
  > **username_1**: I think you can use one single command `composer remove vendor/package/name` as you have the access of SSH  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-11-03. Score: 3 | Accepted answer
  
  You will need to enable it to uninstall it but you can do everything via CLI.
  
  First `./craft plugin/enable plugin-handle` then `./craft plugin/uninstall plugin-handle` then `composer remove namespace/package-name`.
  
  If you really can't enable it as above, you'd need to `composer remove namespace/package-name` and manually remove any references in your `plugins` table, project config as well as any tables the plugin may have created on install.
  
  > **Comments:**
  > **username_0**: Thank you. After posting, it dawned on me that, as you mention, without enabling the plugin, it can't do its own cleanup upon uninstalling.  
  
  ---
  
  