Title: problem with paths wordpress in subfolder
Last modified: September 5, 2021

---

# problem with paths wordpress in subfolder

 *  Resolved [travaudoma](https://wordpress.org/support/users/travaudoma/)
 * (@travaudoma)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/problem-with-paths-wordpress-in-subfolder/)
 * i moved kernel files wordpress to a subfolder
    now have a folder “content” and“
   kernel” at root and got some problems some commands only work with subfolder “
   kernel” for example… i use this function for to add changetime for name js and
   css
 *     ```
       function put_modified_time_version($src, $baseUrl){
           if ($src && strpos($src, $baseUrl) === 0) {
               $newSrc = remove_query_arg('ver', $src);
               $path = substr($newSrc, strlen($baseUrl));
               $path = wp_parse_url($path, PHP_URL_PATH);
               if ($mtime = @filemtime(untrailingslashit(ABSPATH) . $path)) {
                   $src = add_query_arg('ver', $mtime, $newSrc);
               }
           }
           return $src;
       }
       add_filter('style_loader_src', 'modified_time_version_style', 15, 1);
       function modified_time_version_style($src) {
           return ($src) ? put_modified_time_version($src, wp_styles()->base_url) : $src;
       }
       add_filter('script_loader_src', 'modified_time_version_script', 15, 1);
       function modified_time_version_script($src) {
           return ($src) ? put_modified_time_version($src, wp_scripts()->base_url) : $src;
       }
       ```
   
 * this works only for js and css in “kernel” folder
 * function work from a folder “content”
    think that a problem with `$url = substr(
   $newSrc, strlen($baseUrl));` tell me how it is better to specify it correctly
   so that everything would work?
    -  This topic was modified 4 years, 9 months ago by [travaudoma](https://wordpress.org/support/users/travaudoma/).

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/problem-with-paths-wordpress-in-subfolder/#post-14843115)
 * WP is not designed to utilize that sort of folder structure. WP can reside in
   a subfolder, but your code using WP resources should reside in a theme, child
   theme, or plugin; all of which reside in /wp-content/. You’ll have continuing
   path issues with the structure you are attempting.
 * What you can do is move the entire /wp-content/ structure and have it reside 
   elsewhere. See [https://wordpress.org/support/article/editing-wp-config-php/#moving-wp-content-folder](https://wordpress.org/support/article/editing-wp-config-php/#moving-wp-content-folder)
 * You’ll see in subsequent sections of that link that most folders directly below/
   wp-content/ can also be similarly moved.

Viewing 1 replies (of 1 total)

The topic ‘problem with paths wordpress in subfolder’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/problem-with-paths-wordpress-in-subfolder/#post-14843115)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
