GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   wordpress help (https://gfy.com/showthread.php?t=775224)

div3x 10-09-2007 11:19 AM

wordpress help
 
anyone know's how to find url string on all posts like out.php and replace it by exit.php for example without beeing done one by one


thanks

sortie 10-09-2007 12:28 PM

I don't use wordpress but this may help.


#!/usr/bin/perl
print "content-type: text/html\n\n";
$filname = "some/file/on/server/path.ext";
open(DD, "$filename");
@dd = <DD>;
close(DD);
$newdd = join("", @dd);
$newdd =~ s/out.php/exit.php/ig;
open(DD, ">$filename");
print DD $newdd;
close(DD);
print "completed";
exit;

Change the yellow stuff to the actual file.

fusionx 10-09-2007 12:37 PM

THIS IS DANGEROUS CODE - run it at your own risk. Test it on a test install of word press first to be sure it's right. I have not tested this!

This should do it. If there are any other uses of out.php it will replace them as well, so if you can, add more identifying info, like your domain name, etc - as much as you can add into the replacement strings the better. It has to exactly match what it will find in the posts, of course.

In this code, the first string 'out.php' will get replaced with 'exit.php' in all posts.

Do I need to remind you to back up your database first? :)

If you don't know how to run SQL commands or you don't have access to the database, look for a wordpress plugin that will do search and replace.

Code:

UPDATE wp_posts
SET post_content=(
REPLACE (post_content,
'out.php',
'exit.php'));



All times are GMT -7. The time now is 08:24 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123