Forked from mkdizajn/wordpress plugin rewrite media path
Created
November 16, 2017 06:55
-
-
Save pankamilr/7ea01eb33137742b84efcc2596b67523 to your computer and use it in GitHub Desktop.
wordpress plugin rewrite media path
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: Rewrite Wordpress upload path | |
Plugin URI: http://mkdizajn.com | |
Description: Rewrites your image paths. | |
Version: 2.4 | |
Author: kreso | |
Author URI: http://mkdizajn.com/ | |
*/ | |
function rewrite_url($rewrite) | |
{ | |
$rewrite = str_replace('yoursite.com/wp-content/uploads/', 'media.yoursite.com/wp-content/uploads/', $rewrite); | |
return $rewrite; | |
} | |
add_filter('wp_get_attachment_url', 'rewrite_url'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment