Support » Fixing WordPress » Deleted old Admin User and broke image links

  • Hello, recently I wanted to clear up the amount on Users on a site for security reasons – there were multiple Users with admin status who no longer work on the site.

    Before deleting the Users who had admin rights I reassigned their content to me. I then deleted those Users. However all images which had been uploaded by the old Admin Users, for posts or pages, are now missing in both Media and from the front end of the site.

    I’ve looked in the back end and the images are still there so I think I either need to re-link the mysqul database to the site (not sure?) or fix the URLs for the images from within WordPress.

    I can’t find any info on how to edit just one image link URL – most info is relating to fixing URLs after WP migration, and I haven’t migrated the site.

    Can anyone give me advice or direction as to where I should fix this problem?

Viewing 6 replies - 1 through 6 (of 6 total)
  • You might be able to change that in the database. If you are comfortable with that or have access to something visual like PHPmyAdmin.

    The images from the media library can be found in the wp_posts (or whatever your post table is prefixed with) and are under the “attachment” post_type. Maybe you can just change the post_author column to be ‘1’ which is usually the ID specified for the main Admin. It might be worth a shot trying one image and if that fixes it then change the rest. To my knowledge there is no other reference to a post author other than that.

    Hi, thanks for replying. Which database? mysql or php – I’m happy to edit php but would need explicit direction.

    I tried a restore from back up but that didn’t fix the problem – even though I could see the old Users (that’d I’d deleted) back in the dashboard under Users.

    Is it actually possible to edit an image link from within WordPress? I was told by my Host provider that I should edit the link from with WordPress but when I try to do this, going into the post and trying to delete part of the URL, it wouldn’t allow.

    The longwinded way is that I’ve downloaded one image from the backend and reuploaded it via the dashboard – but I just can’t do this for so many!

    Also, I’ve just re-read your post – if I were to changed the post-author column how would that change the path of one image? Wouldn’t that then just be set for all images?



    If you’re using a cache plugin, make sure to disable it while you are making changes to the database. Otherwise you will not see the changes until the cache expires or is purged.

    You can edit individual database entries with phpMyAdmin, but the fastest way to handle this is to execute a query. It would look something like this:

    UPDATE wp_posts set post_author = 1 WHERE post_author = 34 AND post_type = 'attachment'

    You would need to replace the two author IDs with the ones valid for your site.

    Warning: UPDATE queries are dangerous…you can break your site with an incorrect query! Please be 100% certain the query is correct before executing it. If you don’t want to take the chance, then edit the entries individually.

    Which database? mysql or php

    I mean the database for your WordPress site. Which is probably a MySQL database. And Dion is right about queries, so be warned. If you have just a few images that are affected then using a visual Database tool like phpMyAdmin would make it easy to see what you are doing.

    Thanks both for your help – I’m waiting to hear back from the theme developers to find out if it’s actually an issue with a js element not updating due to being blocked by the security plugins I’ve got in place. So once I’ve got a response on that and I can eliminate it as a possible cause and move on to looking at the links from mysql – Process of elimination but I’ll be back!



Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Deleted old Admin User and broke image links’ is closed to new replies.