This code modifies various URLs in WordPress generated by the Yoast SEO plugin to replace the domain with the current domain.
Here's a breakdown of what the code does:
-
The code adds filters to various Yoast SEO functions in the
functions.php
file to modify specific URLs. These filters ensure that the URLs are updated with the current domain. -
The
change_domain_in_link
function is a callback function used by the filters. It takes a URL as input and replaces the domain in the URL with the current domain. It uses thestr_ireplace
function to perform the replacement. -
The
recursive_array_search_callback
function is a helper function used by thechange_domain_in_links
function. It recursively searches for a specific value in a multidimensional array and applies a callback function to the found value. In this case, it is used to search for URLs starting with "https://" in the schema graph data.