Spam泛濫的時代如何控制好WordPress不被這些評論內(nèi)容鏈接鏈接導(dǎo)致網(wǎng)站被K,影響到整站的SEO,這是很重要的,
wordpress除去評論者和評論內(nèi)容鏈接
。WordPress除去評論者和評論內(nèi)容鏈接
把如下代碼加入主題模板函數(shù)functions.php文件中,修改前記得先備份functions.php文件,加在中間即可。
<span style="color: rgb(165, 42, 42); font-weight: normal; font-style. normal; " class="sh_keyword">function</span> <span style="color: rgb(0, 0, 0); font-weight: bold; font-style. normal; " class="sh_function">remove_comment_links</span><span class="sh_symbol">()</span> <span class="sh_cbracket">{</span> global $comment<span class="sh_symbol">;</span> $url <span class="sh_symbol">=</span> <span style="color: rgb(0, 0, 0); font-weight: bold; font-style. normal; " class="sh_function">get_comment_author_url</span><span class="sh_symbol">();</span> $author <span class="sh_symbol">=</span> <span style="color: rgb(0, 0, 0); font-weight: bold; font-style. normal; " class="sh_function">get_comment_author</span><span class="sh_symbol">();</span> <span style="color: rgb(165, 42, 42); font-weight: normal; font-style. normal; " class="sh_keyword">if</span> <span class="sh_symbol">(</span> <span style="color: rgb(0, 0, 0); font-weight: bold; font-style. normal; " class="sh_function">empty</span><span class="sh_symbol">(</span> $url <span class="sh_symbol">)</span> <span class="sh_symbol">||</span> <span style="color: rgb(255, 0, 255); font-weight: normal; font-style. normal; " class="sh_string">'http://'</span> <span class="sh_symbol">==</span> $url <span class="sh_symbol">)</span> $<span style="color: rgb(165, 42, 42); font-weight: normal; font-style. normal; " class="sh_keyword">return</span> <span class="sh_symbol">=</span> $author<span class="sh_symbol">;</span> <span style="color: rgb(165, 42, 42); font-weight: normal; font-style. normal; " class="sh_keyword">else</span> $<span style="color: rgb(165, 42, 42); font-weight: normal; font-style. normal; " class="sh_keyword">return</span> <span class="sh_symbol">=</span> $author<span class="sh_symbol">;</span> <span style="color: rgb(165, 42, 42); font-weight: normal; font-style. normal; " class="sh_keyword">return</span> $<span style="color: rgb(165, 42, 42); font-weight: normal; font-style. normal; " class="sh_keyword">return</span><span class="sh_symbol">;</span> <span class="sh_cbracket">}</span> <span style="color: rgb(0, 0, 0); font-weight: bold; font-style. normal; " class="sh_function">add_filter</span><span class="sh_symbol">(</span><span style="color: rgb(255, 0, 255); font-weight: normal; font-style. normal; " class="sh_string">'get_comment_author_link'</span><span class="sh_symbol">,</span> <span style="color: rgb(255, 0, 255); font-weight: normal; font-style. normal; " class="sh_string">'remove_comment_links'</span><span class="sh_symbol">);</span> <span style="color: rgb(0, 0, 0); font-weight: bold; font-style. normal; " class="sh_function">remove_filter</span><span class="sh_symbol">(</span><span style="color: rgb(255, 0, 255); font-weight: normal; font-style. normal; " class="sh_string">'comment_text'</span><span class="sh_symbol">,</span> <span style="color: rgb(255, 0, 255); font-weight: normal; font-style. normal; " class="sh_string">'make_clickable'</span><span class="sh_symbol">,</span> <span style="color: rgb(255, 0, 255); font-weight: normal; font-style. normal; " class="sh_number">9</span><span class="sh_symbol">);</span>
這樣設(shè)置以就可以除去WordPress評論者和評論內(nèi)容鏈接,