• Resolved pattyjansen

    (@pattyjansen)


    I run wordpress multisite with five subsites in subdirectories.

    I have the image media path defined as absolute in the functions.php file for all sites. It works as intended, except…

    One of the sites uses a relative path for some reason. I would very much like to fix this. It wasn’t like this when I set it up.

    I have Jetpack turned on as site-wide plugin. I disabled and reconnected it. No banana.

    The subsite with the problem is rather simple and has no plugins that I don’t use elsewhere.

    It runs the same theme as the other subsites.

    I checked all the settings. I’m out of ideas. How can I even start figuring out how to fix this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @pattyjansen

    Sorry for the trouble. To troubleshoot this issue, you can try the following steps:

    1. Check the functions.php file of the theme that the problematic subsite is using, and make sure that the image media path is defined as an absolute path in this file. If it is not, you can add the following code to define the absolute path for the image media:

    update_option( 'upload_path', '/absolute/path/to/wp-content/uploads' );
    update_option( 'upload_url_path', 'http://example.com/wp-content/uploads' );

    2. If the image media path is already defined as an absolute path in the functions.php file, you can try deactivating and reactivating the theme on the problematic subsite to see if that fixes the issue.

    3. If the issue persists after trying the above steps, you can check the database for the problematic subsite to see if the upload_path and upload_url_path options are set correctly. You can do this by running the following SQL query on the database:

    SELECT * FROM wp_options WHERE option_name IN ('upload_path', 'upload_url_path');

    4. If the upload_path and upload_url_path options are set correctly in the database, you can try checking the .htaccess file for the problematic subsite to see if any rewrite rules might affect the image media path.

    5. Check the wp-config.php file for the problematic subsite to see if the WP_CONTENT_URL and WP_CONTENT_DIR constants are defined correctly. These constants can override the default values for the upload_url_path and upload_path options. If the values are incorrect or not set correctly, you can update them as follows:

    define( 'WP_CONTENT_URL', 'http://example.com/wp-content' );
    define( 'WP_CONTENT_DIR', '/absolute/path/to/wp-content' );

    6. Check the wp-settings.php file for the problematic subsite to see if the UPLOADS constant is defined correctly. This constant is used to define the default value for the upload_path option. If the value is incorrect or not set correctly, you can update it as follows:

    define( 'UPLOADS', '/absolute/path/to/wp-content/uploads' );

    7. If you find any options set incorrectly, you can update them using the UPDATE SQL command. For example:

    UPDATE wp_options SET option_value = '/absolute/path/to/wp-content/uploads' WHERE option_name = 'upload_path';

    You can contact the hosting provider if none of the above steps help. It might be helpful to provide them with as much information as possible about your setup, including the version of WordPress you are using, the theme and plugins you have installed, and any other relevant details.

    Thread Starter pattyjansen

    (@pattyjansen)

    Thank you very much for your detailed response. It’s late and I will check this tomorrow morning, but just to make sure…

    Because I’m running WP multisite (subdirectories) there is only one wp-config file, right? That’s the same for all sites. I use the same theme for all sites, too. Yet only one site gives me this issue.

    Thread Starter pattyjansen

    (@pattyjansen)

    Huh, OK, so messing with the theme does nothing (and I do use the same theme for all other sites), but when I look in the database, a relative path is defined for all subsites and the uploads_url_path is empty for all… except for the offending site, where the relative path was defined.

    I deleted that option, and now it works again!

    (I guess a plugin inserted the line but never deleted it when I deactivated the plugin)

    Thank you so much!

    • This reply was modified 3 years, 5 months ago by pattyjansen.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘media path absolute vs relative issue wordpress multisite’ is closed to new replies.