1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to remove links directly from database?

Discussion in 'Blogging' started by trecords, Jun 13, 2009.

  1. trecords

    trecords Registered Member

    Joined:
    Oct 5, 2008
    Messages:
    96
    Likes Received:
    87
    Hello,
    I have a little question, how to remove links from posts in wp? I have 15000 articles on my database and i`m searching for a tool mass remove the link. There is only one domain which i want to remove.
    Actually, i migrated all these content from joomla. Blogged with joomla nearly 3 month and no visits :( Recommendation: never use joomla for blogging, it is only for community sites.

    Thank you.
     
  2. trecords

    trecords Registered Member

    Joined:
    Oct 5, 2008
    Messages:
    96
    Likes Received:
    87
    No one want to answer me? :(
     
  3. traffictart

    traffictart Newbie

    Joined:
    Dec 14, 2006
    Messages:
    23
    Likes Received:
    5
    I'm not clear on what you want to do here. You can use any one of a number of wordpress search-and-replace plugins to replace an old domain name with a new one. You can use the WP No External Links plugin to avoid using link juice. All available at wordpress.org.

    I'm not aware of any plugin that just removes all links.

    Leigh
     
    • Thanks Thanks x 1
  4. trecords

    trecords Registered Member

    Joined:
    Oct 5, 2008
    Messages:
    96
    Likes Received:
    87
    lol i used search-and-replace plugin and nearly 2 hours it loaded server and all my sites hosted on this server got down, also cpanel.

    My problem solved, thanks.
     
  5. dumdumz

    dumdumz Registered Member

    Joined:
    Jan 5, 2009
    Messages:
    50
    Likes Received:
    6
    Unfortunately REGEXP() in MySQL only returns Yes or No if a match was found so its not possible to use it in a REPLACE() statement. The best solution here would be to use php and preg_replace() however, with that many rows, I can see why the search and replace plugin would hammer your server. I haven't used it but it probably uses built in wordpress api functions to update the posts. The problem with most of those functions is they make tons of database queries each time so you probably ran over 100k queries to update those 15k posts. A better solution would be to just include your database connection into an external script, select the posts, preg_replace() your links, then update the post in the database. This would use much less db queries. It would still be pretty slow due to preg_replace() but I doubt it would take more than 10-15 minutes.
     
  6. dumdumz

    dumdumz Registered Member

    Joined:
    Jan 5, 2009
    Messages:
    50
    Likes Received:
    6
    Another option you could use add_filter('the_content', 'your_callback'); then use a callback function to remove the links from the posts at runtime. They would still exist in your database but will be removed when the content shows on the page. If you later decided you wanted your links back, just remove the filter and they will show again.
     
  7. fangbin

    fangbin Newbie

    Joined:
    Jun 17, 2009
    Messages:
    11
    Likes Received:
    0
    can i use that search-and-replace in a shared hosting or will i get my account suspended?