I’m trying to disable all functionality related to pingbacks/trackbacks in WordPress and so far I have this:
add_action( 'pre_ping', 'disable_pingback' );
function disable_pingback( &$links ) {
foreach ( $links as $l => $link ) {
if ( 0 === strpos( $link, get_option( 'home' ) ) ) {
unset( $links[ $l ] );
}
}
}
However when I open up the page options and enable discussion, I still see this:
I found this answer (method 2), but it is over 5 years old now and I wasn’t sure if totally replacing the whole section was the best way to do things compatibility wise, so I am asking again…
Is there a cleaner way to accomplish this?
5 Answers
Your code is correct, AFAIK. It will disable the ability to do trackback/pings. It doesn’t remove that option from the screen, as you have noticed.
Not sure how to test that, though. But your code should work to disable the actual process of allowing trackback/ping.
This site might test trackback/pings https://tech.wizbangblog.com/ping.php . No experience with it, so YMMV.