-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #996 from 10up/fix/989-migration-guide
Add migration guide for canonical URL replacement
- Loading branch information
Showing
3 changed files
with
38 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Migration Guide Version 1 to Version 2. | ||
|
||
Version 2 of Distributor includes a number of breaking changes that will require updates to custom code you may have written for distributor. | ||
|
||
### Remove canonical links for both Internal and External Connections | ||
|
||
The code snippet required to prevent sites from displaying the source post as canonical URLs for distributed posts has changed. | ||
|
||
If you have implemented this using the code snippet from our tutorial file, please update your code to the following: | ||
|
||
```php | ||
/** | ||
* Stop Distributor from changing the canonical links. | ||
* | ||
* This removes Distributor's canonical functionality from both Internal and | ||
* External Connections. | ||
* | ||
* This accounts for sites using either WordPress or Yoast SEO to generate the | ||
* canonical URL. | ||
*/ | ||
add_action( 'plugins_loaded', function() { | ||
add_action( 'get_canonical_url', '\\Distributor\\Hooks\\get_canonical_url', 10, 2 ); | ||
add_action( 'wpseo_canonical', '\\Distributor\\Hooks\\wpseo_canonical', 10, 2 ); | ||
} ); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters