• ericdrvn

    (@ericdrvn)


    Im building an high available and fault tolerant WordPress enviroment on AWS and it working fine,

    i have my linux ami with /var/www/html mounted on efs and /var/www/html/wp-content mounted on S3 bucket,

    it is mounted like this: mybucket/wp-content/ to /var/www/html/wp-content so when an admin install a plugin from the admin panel the static file go directly on the s3 bucket, or if someone want add sometings can direct from the s3 bucket

    then i created a cloudfront distribution for that s3 bucket and i added a record dns whit static.mydomain.com to point to the cloudfront url, and finally added the following line to wp-settings.php

    define(‘WP_CONTENT_URL’, ‘https://static.mydomain/wp-content’)

    everything is working fine!

    i want to do the same thing for wp-includes folder and im wondering how to define and change the wp-includes url on the php file

    Thanks in advance

Viewing 1 replies (of 1 total)
  • Howdy_McGee

    (@howdy_mcgee)

    Looks like there’s a hook for that -> includes_url. You should be able to create an MU Plugin ( so that it loads as early as possible ) and add in the filter hook. Something like this:

    /**
     * Modify the wp-includes URL
     *
     * @param String $full_url
     * @param String $file_path
     *
     * @return String $modified_url
     */
    function wpf13668150_modify_includes_url( $full_url, $file_path ) {
    	
    	/**
    	 * Example Value:
    	 * $full_url  = https://example.com/wp-includes/js/thickbox/loadingAnimation.gif
    	 * $file_path = js/thickbox/loadingAnimation.gif
    	 * 
    	 * Note $file_path does not begin with a slash.
    	 */
    	$modified_url = 'https://static.mydomain/wp-includes/' . $file_path;
    	
    	return $modified_url;
    	
    }
    add_filter( 'includes_url', 'wpf13668150_modify_includes_url', 10, 2 );

    As far as I know there’s no wp-config.php constant for this.

Viewing 1 replies (of 1 total)
  • The topic ‘Change url wp-incudes to cdn url/wp-includes’ is closed to new replies.