wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Make sure we have a URL when the canonical is empty

Open jdevalk opened this issue 2 years ago • 0 comments

Context

  • In some cases, when plugins or themes add custom URL types to WordPress, we can't detect the proper canonical. This messes up our Schema too, this fix prevents us from outputting broken schema by using the current URL in the schema instead.

Summary

This PR can be summarized in the following changelog entry:

  • When we don't have a canonical, use the current URL in the Schema output.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Install BBPress;
  • go to any user profile page in the BBPress forum;
  • see that the schema is completely broken without this fix and correct with it.

Test instructions for QA when the code is in the RC

  • [x] QA should use the same steps as above.

Impact check

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

  • Please test Schema output on a few more page types.

Quality assurance

  • [x] I have tested this code to the best of my abilities
  • [ ] I have added unittests to verify the code works as intended

Fixes PRODUCT-190

jdevalk avatar Jun 22 '22 12:06 jdevalk