the-seo-framework icon indicating copy to clipboard operation
the-seo-framework copied to clipboard

Cannot unset AhrefsSiteAudit using the_seo_framework_robots_blocked_user_agents

Open tixxwp opened this issue 11 months ago • 2 comments

After enabling the ‘Block SEO marketing crawlers’ option in the plugin configuration, I cannot exclude the AhrefsSiteAudit bot using the_seo_framework_robots_blocked_user_agents filter. With the instruction unset( $agents[‘AhrefsBot’], $agents[‘AhrefsSiteAudit’] ); AhrefsBot is removed while AhrefsSiteAudit remains in the robots.txt file.

tixxwp avatar Jan 25 '25 12:01 tixxwp

Hello!

I added an extraneous space to the agent name. Sorry about that!

This code will work until that's fixed. It's forward-compatible with the next update:

add_filter(
	'the_seo_framework_robots_blocked_user_agents',
	function ( $agents ) {

		unset( $agents['AhrefsBot'], $agents['AhrefsSiteAudit '], $agents['AhrefsSiteAudit'] );

		return $agents;
	},
);

sybrew avatar Jan 25 '25 13:01 sybrew

Hello Sybre. Thank you for your very quick reply and for solving the problem. I confirm that it works.

tixxwp avatar Jan 25 '25 14:01 tixxwp

This issue has already been fixed in https://github.com/sybrew/the-seo-framework/commit/41f9744f50722e53d625c98b2adfebd1f53f8f2e#diff-9f19b69e6aef13aaaec5256b8929d8df2446e2d4a1b45efc566bbdd04cb119f3L112.

I was testing Copilot Agent, and it found that, but it went for a spin. Sorry for the noise.

sybrew avatar Jun 21 '25 16:06 sybrew