刪除 Yoast SEO 外掛在前臺網頁原始碼內的廣告 This site is optimized with the Yoast …

正在檢視 2 個帖子:1-2 (共 2 個帖子)
  • 作者
    帖子
  • 詩語
    管理員
    • 文章數量: 5,930
    @feibisi
    樓主

    現在這些外掛真的是煩的很,網站後臺各種廣告也就算了,前臺原始碼裡也不忘了給自己宣傳,真是夠了。

    安裝 Yoast SEO 外掛後,會在原始碼中出現一串下面的文字:

    <!-- This site is optimized with the Yoast SEO plugin v9.6 - https://yoa.st/1yg?utm_content=9.6 -->

    雖然是註釋掉了的,但看著就是不爽,刪掉的程式碼如下:

    將下面程式碼,新增到你主題或者子主題的 functions.php 檔案裡。

    // Remove All Yoast HTML Comments
    //if (defined('WPSEO_VERSION')) {
      add_action('wp_head',function() { ob_start(function($o) {
      return preg_replace('/^\n?\<\!\-\-.*?[Y]oast.*?\-\-\>\n?$/mi','',$o);
      }); },~PHP_INT_MAX);
    //}

    儲存後前臺去重新整理看,就沒有了。

    詩語
    管理員
    • 文章數量: 5,930
    @feibisi
    樓主

    不會用程式碼的就用外掛,直接下載安裝啟用就行。

    Remove Yoast SEO Comments

正在檢視 2 個帖子:1-2 (共 2 個帖子)
  • 哎呀,回覆話題必需登入。

話題資訊

  • 當前位於:Yoast SEO
  • 1 條回覆
  • 1 個參與人
  • 最後回覆:<a href="https://bbs.weixiaoduo.com/users/feibisi/" title=" 檢視詩語的個人資料" class="bbp-author-link"><span class="bbp-author-name"> 詩語</span></a>
  • 上次活動:<a href="https://bbs.weixiaoduo.com/topic/30461/#post-30468" title=" 回覆至:刪除 Yoast SEO 外掛在前臺網頁原始碼內的廣告 This site is optimized with the Yoast …">6 年、 1 月前</a>