清理yoast seo后台广告

后台适当留广告是可以接受的,但yoast满屏的广告有点过份了。写了个段去广告代码,加到主题的functions.php即可去除yoast seo所有广告。

add_action('admin_enqueue_scripts',function (){
    echo "<style>,div.yoast-sidebar
            ,div.yoast_premium_upsell_admin_block
            ,div#wpseo-local-seo-upsell
            ,div#yoast-help-center-container
            ,div.yoast-container__warning
            ,div.yoast-container.yoast-container__configuration-wizard
            ,[aria-label='Social']
            ,div.wpseo-metabox-buy-premium
            ,button.wpseo-keyword-synonyms
            ,button.wpseo-multiple-keywords
            ,[class*='AnalysisUpsell']
            ,button#yoast-additional-keyphrase-collapsible-metabox
            {display:none!important;}
        </style>";
});

如何彻底删除yoast seo

卸载yoast seo插件后,相关数据并没有被删除,仍保存在数据表中。如果需要彻底移除。

登录phpmyadmin,找到网站对应的数据库,

DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_metadesc';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_title';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_canonical';
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_redirect';

如果数据表前缀不是wp_,注意改为正确的前缀再执行命令。

Leave a Reply

Close Menu