Cannot unset AhrefsSiteAudit using the_seo_framework_robots_blocked_user_agents
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.
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;
},
);
Hello Sybre. Thank you for your very quick reply and for solving the problem. I confirm that it works.
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.