Enable the Hidden File Upload Path Setting in WordPress Media Settings
This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文
Sometimes we need to serve images from a separate CDN domain to speed up loading. Instead of using a plugin, we can configure WordPress's built-in URL settings directly in code;
if(get_option('upload_path')=='wp-content/uploads' || get_option('upload_path')==null) { update_option('upload_path',WP_CONTENT_DIR.'/uploads'); }
Just add this code to function.php.
Last updated 2025-01-14
Comments 0