How do this with wordpress? Mass replace post content and links

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tonyparra
    Confirmed User
    • Jul 2008
    • 4568

    #1

    How do this with wordpress? Mass replace post content and links

    Hello i bought a bbw blog thats filled with pirate download links like this

    http://pimpandhost.com/images/141000-original.html

    and text like this (links are not clickable on blog) I would like to completely delete this box on about 1200 post

    [downloads_box title="Big Big Babes 29"]

    http://depositfiles.com/files/wcqsj715h

    http://depositfiles.com/files/lyfqkq95c

    http://depositfiles.com/files/v58orlv23

    or

    http://www.wupload.com/file/78468061...AABU.part1.rar

    http://www.wupload.com/file/78730349...AABU.part2.rar

    http://www.wupload.com/file/78771182...AABU.part3.rar

    [/downloads_box]


    The issue with search and replace plugin i see so far is i cant do this:

    Search for: http://pimpandhost.com/images/*any query string*
    and Replace with: aebn link or something.

    Is there a way to do this in mysql or should i just delete the 1200+ post? The blog has 3900 + post of course the latest 1200 are pirate link post but I for some reason i think this kid would have made more money with all sponsor content, but looks like when the fetishhits rss feed stopped he started pirating lol. Anyways any help with this would be appreciated thanks.
    Last edited by tonyparra; 03-21-2012, 01:19 PM.

    High Performance Vps $10 Linode
    Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot
  • tonyparra
    Confirmed User
    • Jul 2008
    • 4568

    #2
    bumppppp

    High Performance Vps $10 Linode
    Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

    Comment

    • pr0phet
      Confirmed User
      • Jan 2005
      • 1041

      #3
      just search and replace the domain names in mysql and then send to your own domain that just refreshes all the 404's etc to your own landing page or to aebn if they catch your refreshes.
      Pr0phet

      Comment

      • tonyparra
        Confirmed User
        • Jul 2008
        • 4568

        #4
        Originally posted by pr0phet
        just search and replace the domain names in mysql and then send to your own domain that just refreshes all the 404's etc to your own landing page or to aebn if they catch your refreshes.
        ok got the first part come again?

        High Performance Vps $10 Linode
        Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

        Comment

        • mromro
          So Fucking Banned
          • Jan 2011
          • 770

          #5
          search and replace plugin

          http://wordpress.org/extend/plugins/search-and-replace/

          Comment

          • tonyparra
            Confirmed User
            • Jul 2008
            • 4568

            #6
            fuck it ill just delete this shit

            High Performance Vps $10 Linode
            Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

            Comment

            • ottopottomouse
              She is ugly, bad luck.
              • Jan 2010
              • 13177

              #7
              Originally posted by tonyparra
              ok got the first part come again?
              404 page with PHP redirect either to your home page or sponsor - it will collect everyone that goes to one of the replaced links as they don't exist as a file on your domain.
              ↑ see post ↑
              13101

              Comment

              • fris
                Too lazy to set a custom title
                • Aug 2002
                • 55682

                #8
                Originally posted by tonyparra
                fuck it ill just delete this shit
                do search and replace regex, and get the regex for the download box part, if thats the only thing you are removing.
                Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                Comment

                • fris
                  Too lazy to set a custom title
                  • Aug 2002
                  • 55682

                  #9
                  regex could be something like

                  Code:
                  $html = '[downloads_box title="big boobs"]http://www.domain.com/files/files.avi.html[/downloads_box]';
                  $regex = '/\[(\[?)(downloads_box)\b([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)/s';
                  $new = preg_replace($regex,' replacement',$html);
                  echo $html . 'will be replaced with' . $new;
                  or something
                  Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                  Comment

                  • Brujah
                    Beer Money Baron
                    • Jan 2001
                    • 22157

                    #10
                    It looks like a shortcode plugin or function "downloads_box", could you just deactivate/delete the plugin? Then add this to your functions.php file somewhere to empty the info.

                    Code:
                    function my_downloads_box( $atts, $content = null ) {
                     return '';
                    }
                    add_shortcode( 'downloads_box', 'my_downloads_box' );

                    Comment

                    • fris
                      Too lazy to set a custom title
                      • Aug 2002
                      • 55682

                      #11
                      Originally posted by Brujah
                      It looks like a shortcode plugin or function "downloads_box", could you just deactivate/delete the plugin? Then add this to your functions.php file somewhere to empty the info.

                      Code:
                      function my_downloads_box( $atts, $content = null ) {
                       return '';
                      }
                      add_shortcode( 'downloads_box', 'my_downloads_box' );
                      ya that would be easiest to null the return
                      Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                      Comment

                      • tonyparra
                        Confirmed User
                        • Jul 2008
                        • 4568

                        #12
                        you guys are past awesomeness

                        High Performance Vps $10 Linode
                        Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

                        Comment

                        • fris
                          Too lazy to set a custom title
                          • Aug 2002
                          • 55682

                          #13
                          if you want to remove it completely from the db, here is the code i use/used

                          Code:
                          function remove_shortcode_from_db($shortcode = 'button') {
                          
                              global $wpdb;
                          
                              $posts = $wpdb->get_results("SELECT ID,post_title,post_content FROM $wpdb->posts");
                              $regex = '/\[(\[?)('.$shortcode.')\b([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)/s';
                          
                              foreach($posts as $post) {
                                  $final = preg_replace($regex,'',$post->post_content);
                                  $change = $wpdb->update( $wpdb->posts, array('post_content' => $final), array('ID' => $post->ID));
                              }
                          }
                          Code:
                          remove_shortcode_from_db('downloads_box');
                          always backup your database before doing any mods like this.
                          Last edited by fris; 03-25-2012, 01:25 PM. Reason: ps, only run once.
                          Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                          Comment

                          • just a punk
                            So fuckin' bored
                            • Jun 2003
                            • 32393

                            #14
                            Originally posted by tonyparra
                            How do this with wordpress? Mass replace post content and links.
                            You are a CyberSEO customer. Am I right? If so, just go to CyberSEO->Tools and find the "PHP Code <?php .. ?>" box. You can use it to modify every existing post (title, content, excerpt). For example, if you want to replace "word1" to "word2" in every post and its excerpt, simple put the following code into the "PHP Code <?php .. ?>" box and click the "Apply" button:

                            Code:
                            $post->post_content = str_replace('word1', 'word2', $post->post_content);
                            $post->post_excerpt = str_replace('word1', 'word2', $post->post_excerpt);
                            If you want, say, remove "bad_word" for the post tittle, the code will be as simple as this:

                            Code:
                            $post->post_title = str_replace('bad_word', '', $post->post_title);
                            etc
                            Obey the Cowgod

                            Comment

                            • fris
                              Too lazy to set a custom title
                              • Aug 2002
                              • 55682

                              #15
                              Originally posted by CyberSEO
                              You are a CyberSEO customer. Am I right? If so, just go to CyberSEO->Tools and find the "PHP Code <?php .. ?>" box. You can use it to modify every existing post (title, content, excerpt). For example, if you want to replace "word1" to "word2" in every post and its excerpt, simple put the following code into the "PHP Code <?php .. ?>" box and click the "Apply" button:

                              Code:
                              $post->post_content = str_replace('word1', 'word2', $post->post_content);
                              $post->post_excerpt = str_replace('word1', 'word2', $post->post_excerpt);
                              If you want, say, remove "bad_word" for the post tittle, the code will be as simple as this:

                              Code:
                              $post->post_title = str_replace('bad_word', '', $post->post_title);
                              etc
                              that doesnt revmoe it from the db though, its just being replaced via the post object.
                              Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                              Comment

                              • tonyparra
                                Confirmed User
                                • Jul 2008
                                • 4568

                                #16
                                Originally posted by CyberSEO
                                You are a CyberSEO customer. Am I right? If so, just go to CyberSEO->Tools and find the "PHP Code <?php .. ?>" box. You can use it to modify every existing post (title, content, excerpt). For example, if you want to replace "word1" to "word2" in every post and its excerpt, simple put the following code into the "PHP Code <?php .. ?>" box and click the "Apply" button:

                                Code:
                                $post->post_content = str_replace('word1', 'word2', $post->post_content);
                                $post->post_excerpt = str_replace('word1', 'word2', $post->post_excerpt);
                                If you want, say, remove "bad_word" for the post tittle, the code will be as simple as this:

                                Code:
                                $post->post_title = str_replace('bad_word', '', $post->post_title);
                                etc
                                Yes, i didnt consider this option because i bought the site as is. I used a combo of the things above though. BTW Cyberseo rocks

                                High Performance Vps $10 Linode
                                Manage your Digital Ocean, Linode, or Favorite Cloud Server. Simple, fast, and secure Server Pilot

                                Comment

                                • SZNY
                                  SZNY
                                  • May 2004
                                  • 2800

                                  #17
                                  Here some queries that can be useful

                                  UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

                                  After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:

                                  UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

                                  If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:

                                  UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

                                  UPDATE `wp_postmeta` SET `meta_value` = replace(meta_value, '212-555-1212', '212-444-1212') WHERE `meta_key` LIKE 'DeptPhone'
                                  Last edited by SZNY; 03-27-2012, 01:46 PM.
                                  Telegram: sandroanthonio

                                  Comment

                                  Working...