Created
December 11, 2012 11:09
-
-
Save mkdizajn/4257824 to your computer and use it in GitHub Desktop.
wordpress plugin rewrite media path
This file contains hidden or 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