1
我是WordPress的初學者。我已經安裝了WordPress但我發現儀表板上有很多ping背景顯示。我的問題是我想刪除所有對我無用的ping背。如何停止WordPress ping後退?
我是WordPress的初學者。我已經安裝了WordPress但我發現儀表板上有很多ping背景顯示。我的問題是我想刪除所有對我無用的ping背。如何停止WordPress ping後退?
如薩格爾,在他的回答鏈接它,你可以用代碼做到這一點:
<?php
add_filter('wp_headers', function($headers, $wp_query){
if(isset($headers['X-Pingback'])){
unset($headers['X-Pingback']);
}
return $headers;
}, 11, 2);
add_filter('pre_option_enable_xmlrpc', function($state){
return '0';
});
add_action('wp', function(){
remove_action('wp_head', 'rsd_link');
}, 9);
add_filter('bloginfo_url', function($output, $property){
return ($property == 'pingback_url') ? null : $output;
}, 11, 2);
add_action('xmlrpc_call', function($method){
if($method != 'pingback.ping') return;
wp_die(
'Pingback functionality is disabled on this Blog.',
'Pingback Disabled!',
array('response' => 403)
);
});
?>
假如把它放在你的function.php文件。
或者你可以用a simple plugin來做,如果你不想編碼的話。