Skip to content

Instantly share code, notes, and snippets.

@shubham9411
Last active March 26, 2017 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shubham9411/1790aa352872eb80efca6bbfe1df3054 to your computer and use it in GitHub Desktop.
Save shubham9411/1790aa352872eb80efca6bbfe1df3054 to your computer and use it in GitHub Desktop.
Change https to http urls in Yoast SEO
<?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