Wordpress - How to delete all urls toward specific domain

by Sill7
6 replies
Hello.

Phpmyadmin sql command allows to delete/update content.
However i want to delete (or update to nothing..) all post content links toward external site, while these links are like "hxxp://domain.com/something_something/". These links are in post content not in custom field.

How can i delete all those links with one command? Something like all links containing this url or all link with specific url text.







#delete #domain #specific #urls #wordpress
  • Profile picture of the author Tim Franklin
    be very careful using SQL commands, as if your not careful you will end up with a result you may not have anticipated. you can find any number of search related commands, by consulting the SQL documentation in the PHPmyAdmin console.
    Signature
    Bitcoin | Crypto | Blockchain Secrets |
    {{ DiscussionBoard.errors[5489836].message }}
    • Profile picture of the author Sill7
      Yes, iam aware of that. I did sql backup.
      But i cant find way how to do it.







      {{ DiscussionBoard.errors[5489957].message }}
  • Profile picture of the author kokopelli
    Or, make a SQL dump, open the file in a text editor, and find-and-replace.... then re-import.
    Signature
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    {{ DiscussionBoard.errors[5491851].message }}
    • Profile picture of the author Sill7
      kokopelli:
      Thanks for suggestion, i actually thought about that but.. At that point i would have to search and select every link, which would take lots of time.

      I know there is command LIKE. But was unsuccessful with results.
      I hoped there is some kind of way like in php to select with variables after. Like * or so..





      {{ DiscussionBoard.errors[5493977].message }}
  • Profile picture of the author kokopelli
    At that point i would have to search and select every link, which would take lots of time.
    I do it all the time, it's fast (unless you have a very large database). You probably could've done it it the time it took you to reply ... :rolleyes:

    i want to delete (or update to nothing..) all post content links toward external site, while these links are like "hxxp://domain.com/something_something/". These links are in post content
    Try this:
    1. Backup your database;
    2. Make sure you backup your database;
    3. Did I mention, you have to backup your database?
    4. Then perform this MySQL query:
      Code:
      UPDATE wp_posts SET `post_content`
      = REPLACE (`post_content`,
      'OldURL',
      'NewURL');

    P.S. No guarantees. Don't get mad at me if it doesn't work, or you mess it up.
    Signature
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    {{ DiscussionBoard.errors[5494340].message }}
  • Profile picture of the author Sill7
    Well not really fast, because the urls are different, i can find where they are but then i have to manualy select all "<a href=". When there is 100+ urls its pretty annoying thing to do. Thats why i asked here.
    There must be a way to select all urls pointing to one domain but different pages.

    The query you mentioned does work, i did try to modify it before to work for my case. But it can replace url or replace to nothing, only specific urls. And i want to delete different one domain urls.







    {{ DiscussionBoard.errors[5494967].message }}

Trending Topics