Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot unset AhrefsSiteAudit using the_seo_framework_robots_blocked_user_agents #707

Open
tixxwp opened this issue Jan 25, 2025 · 2 comments
Assignees
Milestone

Comments

@tixxwp
Copy link

tixxwp commented Jan 25, 2025

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.

@sybrew
Copy link
Owner

sybrew commented Jan 25, 2025

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 sybrew self-assigned this Jan 25, 2025
@sybrew sybrew added this to the 5.1.3 milestone Jan 25, 2025
@tixxwp
Copy link
Author

tixxwp commented Jan 25, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants