Canned Spam
Coding

Stopping WordPress trackback spam without plugin


What is the most effective method for combating the trackback that inundates comment sections?

Altering the global Trackbacks configuration through the Dashboard -> Settings -> Discussion will exclusively modify the default behavior.

If you presently have or with trackbacks enabled, adjusting the default setting won’t affect the individual -level .

To address this issue use the following filter to programmatically disapprove any trackback or pingback:

 add_filter('pre_comment_approved',function($approved,$comment){
		
	if( in_array($comment['comment_type'],array(
			
		'trackback',
		'pingback',
		
	))){
        
		$approved = false;
	}
		
	return $approved;
		
},999999,2);

Leave a Reply

About Rafasashi

Currently managing RECUWEB an IT Company providing cloud hosting and SaaS delivery model.

Related posts