![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
search and replace part of url in wordpress posts??
hi
just a quick question. i need to modify part of a url in lots of posts in some wordpress blogs. the table and field is wp_posts post_content so if some of these posts contain the url http://www.somesite.com/folder and i want to change it to http://www.anothersite.com/folder does anyone know what sql i should use in phpmyadmin to make this change on all the posts? there's obviously other text in the posts to be changed that i want left alone its just a particular url i want to change. any help appreciated, thanks in advance |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
it's ok got it now:
UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring"); |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Nov 2009
Location: Heaven
Posts: 4,306
|
nxt time try search and replace.
or for critical tasks, try regex replace |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
marketer.
Industry Role:
Join Date: Aug 2006
Location: bcn
Posts: 2,280
|
u can also write a wp plugin to do this really easily
something like this (untested) add_filter('the_content','myreplacer'); function myreplacer($s) { return str_replace('from','to',$s); } will want to add the_extract possibly too to add_filter. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 55,359
|
Quote:
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. ![]() WP Stuff |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Too lazy to set a custom title
Industry Role:
Join Date: Sep 2003
Posts: 22,651
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |