0

i am total newbie with phpmyadmin, and the first time i use it, was to delete a lot of spam comments.I m not sure is it possible to do what i want , but another option would be to go trough 400-500 articles and do it manually.

ok, what i need with phymyadmin is this.When i started my blog it was with blogger.com which was limited.Two years ago i switched to wordpress,and imported all those posts.Since it was limited i add a lot of links pointing to some other area of blog.

So is its possible to delete for an exmaple all those links from posts without deleting the posts.I want to keep them, and only delete for example some link which they contain.

Trough phpmyadmin search i found all those links and posts, now the only thing i need is to delete automatically this links. I m hoping i explained this well.

1
  • 1
    To clarify, by "links" do you mean the type that is listed under the Links tab in the Dashboard, or hyperlinks within other posts?
    – a web dev
    Commented Jun 13, 2013 at 2:16

1 Answer 1

1

Mysql allows you to run queries that apply to all post, see example :

UPDATE wp_posts SET POST_CONTENT = replace(POST_CONTENT, '<a href="http://mysite.com/my_link">mylink</a>', '');

This code allows you to delete <a href="http://mysite.com/my_link">mylink</a>on all posts. But in your case I doubt all links are the same so you need a pattern. Perhaps it can be done with [REGEXP].1

Do you need to delete all links in content? That would be easier.

EDIT: make a backup of your database before anything !

7
  • Hi and thank you so much for the answer.First i tried and ask Hgator for help,and after almost a hour of talking,and searching for the solution from their part, i v got an answer backup your database and go with trials and errors..lol.. no i dont need to delete all the links because there is lot of them i need, like internal links,paid links and similar..pretty much those links i want to delete are the same links..so this should work...can you tell me where should i go to enter this line of code you wrote ? thanks Commented Jun 13, 2013 at 14:24
  • 1
    The code I gave implies exact match! If you're not familiar with mysql it's probably a bad idea! It's easy to screw up database with poor queries. Anyway you have a tab called "SQL" in phpmyadmin, this is the place where you enter queries.
    – JMau
    Commented Jun 13, 2013 at 14:34
  • Ok i m going to try right now..i already made a backup of database just to be sure. One question,as i dont know anything about this.Inside code is = replace , should it be =delete so those links would be deleted ? just to be sure i am asking Commented Jun 13, 2013 at 14:43
  • no in fact you replace content with nothing which is "the same as" delete
    – JMau
    Commented Jun 13, 2013 at 14:49
  • i m getting this error #1146 - Table 'mydatabasename.wp_posts' doesn't exist ...inside wp_ftposts i can found trough search these links...so should i replace wp_posts with wp_ftposts ? Commented Jun 13, 2013 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.