PDA

View Full Version : Changing affiliate codes in WP post


LD
2009-05-21, 10:09 AM
Is there a utility for this? This is a mainstream site with amazon ads.

Cleo
2009-05-21, 10:23 AM
You could use PhpMyAdmin to do a search and replace on the codes in the MySQL database.

LD
2009-05-21, 12:01 PM
Thanks Cleo...I'm not familiar with using PhpMyAdmin, but it looks pretty straighforward and I have worked with other database tools.

cd34
2009-05-21, 12:13 PM
create table wp_postsbk select * from wp_posts;
update wp_posts set post_content=replace(post_content,'oldstringtoreplace','newstringtouse');


if you mess up:


delete from wp_posts;
insert into wp_posts select * from wp_postsbk;

HowlingWulf
2009-05-21, 12:25 PM
A Google search turned up http://thedeadone.net/download/search-and-replace-wordpress-plugin/

LD
2009-05-21, 03:34 PM
Google...who woulda thought...:)

nate
2009-05-21, 09:15 PM
create table wp_postsbk select * from wp_posts;
update wp_posts set post_content=replace(post_content,'oldstringtoreplace','newstringtouse');



Its scary what some people can quote off the top of their head.

LD
2009-05-22, 12:37 AM
Its scary what some people can quote off the top of their head.

cd34 knows his shit!

Howling, that plug worked like a charm! It took about 5 seconds...no problems whatsoever.

bDok
2009-05-22, 01:19 AM
I know there is a great plugin for wordpress that is actually great for links like that.

another thing that I know that was just released is a free link directing script. Made by the same guy that did tevs tube script. I'll find a link later.

edit:

nevermind simple google found it.

http://www.bigdotmedia.com/

he's calling it tracking adult links sytem (tals).

so then you can change certain things out real easy in the future.

Simon
2009-05-22, 08:25 AM
Just a quick note that you may want to always back up your WP databases before using any of the available plugins to change all your codes in one click. That was something that cd34's code handled by first creating a new table and copying your post data into it in case you needed to revert back to it. Anyone who's ever totally screwed a database with search and replace knows the value of that one line of code.

LD
2009-05-22, 09:31 AM
Just a quick note that you may want to always back up your WP databases before using any of the available plugins to change all your codes in one click. That was something that cd34's code handled by first creating a new table and copying your post data into it in case you needed to revert back to it. Anyone who's ever totally screwed a database with search and replace knows the value of that one line of code.

yes... i kept a local copy before running the plug.