• I’ve a plugin which includes static files this way: wp_enqueue_style('login-notification', plugin_dir_url(__DIR__) . 'style/login-notification.css', '', '1.0.0');

    domain_mapping_plugins_uri function keeps breaking the URLs. The substr( $full_url, stripos( $full_url, PLUGINDIR ) - 1 ) part changes /wp-content/mu-plugins/seravo-plugin into n. So instead of https://www.example.org/wp-content/mu-plugins/seravo-plugin/style/login-notifications.css I’m getting https://www.example.orgn/style/login-notification.css (notice the n on the domain) which obviously doesn’t work.

    I’ve made sure it’s that function which makes the change.

Viewing 1 replies (of 1 total)
  • @joosuak
    Hello, I fixed it on my site by changing the code of the function into :

    // fixes the plugins_url
    function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL ) {
    	$wp_content_dir_exploded = explode(DIRECTORY_SEPARATOR, WP_CONTENT_DIR);
    	$wp_content_foldername = $wp_content_dir_exploded[count($wp_content_dir_exploded) - 1 ];
    	return get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, $wp_content_foldername ) - 1 );
    }

    I have defined WP_CONTENT_DIR in my wp-config.php but it is also defined in wp-load.php so it whould work for you.

Viewing 1 replies (of 1 total)
  • The topic ‘Relative URLs being broke’ is closed to new replies.