Last active
March 26, 2017 12:10
-
-
Save shubham9411/1790aa352872eb80efca6bbfe1df3054 to your computer and use it in GitHub Desktop.
Change https to http urls in Yoast SEO
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
<?php | |
/** | |
* Plugin Name: Open Graph URLs for facebook | |
* Plugin URI: https://shubhampandey.in/migrating-website-http-https/ | |
* Description: Change all your https url to http for facebook for Yoast SEO | |
* Author: Shubham Pandey | |
* Version: 1.0.0 | |
* Author URI: https://shubhampandey.in | |
* License: GPL2+ | |
* | |
* @package CustomURLs | |
*/ | |
/** | |
* Function replaces https to http in urls | |
* | |
* @param string $url url link for replacing | |
**/ | |
function spx_change_https( $url ) { | |
return str_replace( 'https://', 'http://', $url ); | |
} | |
// Filter for open graph url. | |
add_filter( 'wpseo_opengraph_url', 'spx_change_https' ); | |
// Filter for canonical url. | |
add_filter( 'wpseo_canonical', 'spx_change_https' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment