1

I recently purchased a CDN and used a plugin to change the site url for all static files in the "/wp-content" and "/wp-include" folder to the cdn url.

Is there a way to change the site url for static files (espcially images) in the "/wp-admin" to a cdn url?

3
  • 1
    I think there is no easy way to change the URL of that files and I also think there is very little advantage of doing it for your users. In general, there are no static assets loaded from wp-admin in front-end.
    – cybmeta
    Feb 27, 2016 at 6:24
  • I agree this is way more trouble that it's worth. Not to say it couldn't be done, but really a waste of time for "admin images" - I cannot even think of one? Unless by "static files" you are meaning admin stylesheets and javascripts? If so, update your question.
    – majick
    Feb 27, 2016 at 11:54
  • yes, i meant the css, javascript, and the image files in the "media library" section the wp-admin.
    – lee
    Feb 27, 2016 at 16:33

1 Answer 1

0

I'm not sure about the wp-includes but you can quite easily change the URL of your wp-content folder by setting this constant in your wp-config.php file:

define('WP_CONTENT_URL', 'https://mybucket.nyc3.cdn.digitaloceanspaces.com');

By default, the WP_CONTENT_URL constant is set to the URL of the wp-content directory of a WordPress installation. However, it can be customized to point to a different URL or domain, which can be useful in certain scenarios, such as when you want to serve your static content from a CDN or a subdomain.

https://developer.wordpress.org/apis/wp-config-php/#moving-wp-content-folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.