• Resolved Joe

    (@joewa1980)


    We have our theme directory renamed to files and our wp-content directory renamed to files2. This works perfectly across the site except for one area in wp-admin (a post edit page) where images are called from our theme as follows:

    Renamed wp-content causes 404 on each image:
    https://www.example.com/files/includes/vt_resizer.php?src=https://www.example.com/files2/uploads/2020/05/VO.jpg&w=150&h=150&q=100&zc=1

    Reverting wp-content to default loads correctly:
    https://www.example.com/files/includes/vt_resizer.php?src=https://www.example.com/wp-content/uploads/2020/05/VO.jpg&w=150&h=150&q=100&zc=1

    Any ideas? We cannot alter the PHP as it calls the entire URL unfortunately, not just the image filename.

    Many thanks for your help! I’ve spent two days on it and this is my last resort.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Joe

    (@joewa1980)

    This might help too. The piece of code producing the image URL is as follows.

    Note that wp_get_attachment_url is calling the file location using the rewritten wp-content directory which is the cause of the issue.

    <?php
    while($galQ->have_posts()) : $galQ->the_post();
    $image = wp_get_attachment_url(get_the_ID());
    ?>
    <li onclick="jQuery(this)._sf_add_attachemnt_to_gallery();"><img src="<?php echo ddTimthumb($image, 150, 150) ?>" alt="<?php the_ID(); ?>" title="<?php the_ID(); ?>" /s></li>
    Thread Starter Joe

    (@joewa1980)

    In the end I replaced wp_get_attachment_url(get_the_ID()); with the following:

    $image = str_replace('https://www.example.com/wp-content/', '', wp_get_attachment_url(get_the_ID()));

    Hopefully it’ll be useful for someone else in a similar position.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Disable rewrite within wp-admin only?’ is closed to new replies.