How to dequeue third-party plugin enqueued styles and scripts in WordPress

In case you need to remove or dequeue a stylesheet or Javascript file enqueued by some third-party plugin in WordPress you can use the following code sample

Few point to note

  1. If you don’t know the handle used to register the style or script view the source code and find the line where CSS is included like it is shown in the example below

    In this, the “id” attribute has the handler without the “-css” or “-js” postfix. So, in the example above the handler is “dashicons“.
Updated on Jul 29, 2022