wordpress help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • div3x
    Confirmed User
    • Jun 2003
    • 491

    #1

    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
    Confirmed User
    • Mar 2007
    • 7771

    #2
    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.

    Comment

    • fusionx
      Confirmed User
      • Nov 2003
      • 4618

      #3
      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'));

      Comment

      Working...