Skip to content

Add ahrefs connection option.#22573

Merged
leonidasmi merged 2 commits intotrunkfrom
775-add-ahrefs-to-settings-site-connections
Sep 19, 2025
Merged

Add ahrefs connection option.#22573
leonidasmi merged 2 commits intotrunkfrom
775-add-ahrefs-to-settings-site-connections

Conversation

@thijsoo
Copy link
Copy Markdown
Contributor

@thijsoo thijsoo commented Sep 16, 2025

Context

  • We want to allow our users to add their ahrefs connection key.

Summary

This PR can be summarized in the following changelog entry:

  • Introduces the ability to add a Ahrefs verification code via Yoast settings.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Go to /wp-admin/admin.php?page=wpseo_page_settings#/site-connections

  • Add 123123abcabc to the Ahrefs field.

  • Save and make sure you see <meta name="ahrefs-site-verification" content="123123abcabc" class="yoast-seo-meta-tag" /> under our schema output.

  • Copy the entire meta field like in the instruction above and paste it in the Ahrefs field in the settings. Make sure only the 123123abcabc ends up in the field.

  • Also try to add a non-valid character there, like & or %, etc. Confirm you get a warning about it.

  • finally make sure the shortlink goes to https://yoa.st/ahrefs-verification-code.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@thijsoo thijsoo added the changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog label Sep 16, 2025
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 72a32f83bd538175ded6eb1e0a0b39690d232b9f

Details

  • 1 of 4 (25.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.002%) to 53.205%

Changes Missing Coverage Covered Lines Changed/Added Lines %
inc/options/class-wpseo-option.php 0 1 0.0%
src/presenters/webmaster/ahrefs-presenter.php 0 2 0.0%
Totals Coverage Status
Change from base Build 291e2f3fbb6dcfc7315fbdcaaaa8b6ecd0c36e4e: -0.002%
Covered Lines: 31734
Relevant Lines: 59862

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR:

  • One minor thing, to remove Ahref from the search keywords
  • We could add a Ahrefs_Presenter_Test class in the PR

Acceptance:

  • We should probably have ahref instead of Ahref in the input label and help text? At least judging from Manuel's answer here.
  • Not entirely sure about this, so better to double check with UX, but I think we have the inputs in Site Connections in alphabetical order on purpose? If that's the case, maybe we should keep that (same with the order in Yoast\WP\SEO\Integrations\Front_End_Integration)

fieldLabel: __( "Ahrefs", "wordpress-seo" ),
keywords: [
__( "Webmaster", "wordpress-seo" ),
__( "Ahrefs", "wordpress-seo" ),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding the name of the setting is not necessary:

Suggested change
__( "Ahrefs", "wordpress-seo" ),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed everything except the lowercase name. I think that was a mistake from Manuel in the comment since everything is capitalized and Ahrefs is a name so it would make no sense to not do it.

@leonidasmi leonidasmi added this to the 26.1 milestone Sep 19, 2025
Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR + Acceptance is ✅

@leonidasmi leonidasmi merged commit 7541519 into trunk Sep 19, 2025
47 of 52 checks passed
@leonidasmi leonidasmi deleted the 775-add-ahrefs-to-settings-site-connections branch September 19, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants