URL Rewrite using str_replace
-
I use the following to redirect to a CDN , it works fine on WordPress images and anything in uploads on posts or pages but does not work on woocommerce images. I tried to replace “the_content” with “woocommerce_content” it did not work.
function replace_text_wordpress($text) { $text = str_replace('domain.com/wp-content/uploads/', 'domain.s3.amazonaws.com/uploads/', $text); return $text; } add_filter('the_content', 'replace_text_wordpress');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘URL Rewrite using str_replace’ is closed to new replies.