WordPress.org

Ready to get started?Download WordPress

Forums

Media URLs overriding Page/Post URLs (6 posts)

  1. mannski
    Member
    Posted 1 year ago #

    I understand that Media in WordPress is considered a post type, so if you upload an image, there will be an image URL ( /wp-content/uploads/2012/09/picture.jpg ) and post URL ( /picture/ ). The problem is that I have a biography page for Professor Einstein at /faculty/einstein/ and a picture of him at /wp-content/uploads/2012/09/einstein.jpg but when I go to /faculty/einstein/ I am given the media page for the picture, not the page I created at that URL.

    Besides changing the filename of the image and uploading it again, or changing the biography page URL, what is the solution? Can I prevent WordPress from creating post URLs for media?

    I tried searching the forums for solutions but I found nothing for this particular problem, so if I missed it and the solution is already out there, link me!

  2. bythegram
    Member
    Posted 1 year ago #

    Do you have a live link you can share?

    I've never seen this happen before. In my experience sites only redirect if the one entered (/faculty/einstein) doesn't exist, which is why it would redirect to
    /wp-content/uploads/2012/09/einstein.jpg

  3. mannski
    Member
    Posted 1 year ago #

    Update: I did find out that changing the picture's Title to anything besides "einstein" allowed the bio page to show at the /faculty/einstein/ URL. But that's not much better than renaming the image file and uploading it again, or changing the bio page URL. It's a solution, but not the right kind of solution.

  4. mannski
    Member
    Posted 1 year ago #

    bythegram - Sorry, as I just noted, changing the image title fixed the URL issue. I tried changing the image title back to the original, but it's no longer going to the image.

    Here's some more information that may be helpful: the image was uploaded to the /faculty/ page, so the original post URL for it was /faculty/einstein/ , and the bio page URL was originally /albert-einstein/ (created by default). Then the parent page was set to "Faculty" so the URL changed to /faculty/albert-einstein/ and then the URL was manually changed to leave out the "albert" portion, so it became /faculty/einstein/ .

    So, it makes sense that /faculty/einstein was showing the picture because that was the first post at that URL. But the problem is media being able to trump URLs that are being used for pages (even if those pages are created later).

  5. bythegram
    Member
    Posted 1 year ago #

    Glad you found a solution (although as you noted not the perfect solution).

    Since there was those url changes I wonder if it was a cache issue? But I guess it doesn't matter as much now either way.

    All the best!

  6. mannski
    Member
    Posted 1 year ago #

    Thanks. I don't think it was a cache issue. Once I changed the image Title, the URL no longer went to that image, and that happened immediately. As I said, I totally understand why the url was going to that media post, but what I want to find is a way to trump them if I create a page and happen to put it at the same URL.

Topic Closed

This topic has been closed to new replies.

About this Topic