I'm currently developing some Magento2 themes. I noticed that in Magento2 Meta Keywords are still added. I want to remove this meta keywords from all pages, does anyone know the proper way to achieve this?

I did find meta.phtml, but I think this file is not used on a product page. Also the file Product/View.php adds the keywords with this function:


but I don't think it would be the prober way to extend the _prepareLayout function, right?



2 Answers 2


I just had to do the same and decided to just add a plugin after the getKeywords Method of the page config which returns an empty string. works great


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <type name="Magento\Framework\View\Page\Config">
        <plugin name="removeMetaKeywords" type="Vendor\Module\Plugin\PageConfig\RemoveMetaKeywords" sortOrder="9999"/>

Plugin Class:

declare(strict_types = 1);
namespace Vendor\Module\Plugin\PageConfig;

class RemoveMetaKeywords
    public function afterGetKeywords($subject, string $return)
        return '';
  • and the entire <meta name="keywords"... is gone. :) Thanks
    – JustinP
    Feb 6, 2019 at 23:22
  • I get some error on some pages..
    – ozan yeni
    Jan 16, 2020 at 12:37
  • Fatal error: Uncaught TypeError: Argument 2 passed to Learning\FirstUnit\Plugin\PageConfig\RemoveMetaKeywords::afterGetKeywords() must be of the type string, null given, called in
    – ozan yeni
    Jan 16, 2020 at 12:38
  • Change class to: public function afterGetKeywords($subject, $return) { return (string)null; } and the error is gone.
    – Mike
    Mar 21, 2021 at 12:43

Easy to remove or edit default meta keywords at admin configuration:

Store > Configuration > Design [General] - HTML Head
  • 1
    I want it removed from all pages, so also the category and product pages. When you create a product, the meta keywords will be automatically filled and added to the product page. So changing the default meta keywords will not do the trick.
    – Silvan
    Jan 6, 2016 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.