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)
-   -   How do this with wordpress? Mass replace post content and links (https://gfy.com/showthread.php?t=1061943)

tonyparra 03-21-2012 02:15 PM

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.

tonyparra 03-21-2012 02:20 PM

bumppppp

pr0phet 03-21-2012 02:30 PM

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.

tonyparra 03-21-2012 06:05 PM

Quote:

Originally Posted by pr0phet (Post 18837154)
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?

mromro 03-21-2012 06:39 PM

search and replace plugin :thumbsup

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

tonyparra 03-21-2012 07:48 PM

fuck it ill just delete this shit

ottopottomouse 03-21-2012 11:16 PM

Quote:

Originally Posted by tonyparra (Post 18837513)
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.

fris 03-22-2012 06:59 AM

Quote:

Originally Posted by tonyparra (Post 18837629)
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.

fris 03-22-2012 07:29 AM

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

Brujah 03-22-2012 08:51 AM

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


fris 03-22-2012 09:54 AM

Quote:

Originally Posted by Brujah (Post 18838579)
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

tonyparra 03-23-2012 11:39 PM

you guys are past awesomeness :upsidedow

fris 03-25-2012 02:24 PM

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.

just a punk 03-25-2012 02:34 PM

Quote:

Originally Posted by tonyparra (Post 18837118)
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

fris 03-25-2012 04:26 PM

Quote:

Originally Posted by CyberSEO (Post 18844086)
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.

tonyparra 03-27-2012 02:41 PM

Quote:

Originally Posted by CyberSEO (Post 18844086)
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 :thumbsup

SZNY 03-27-2012 02:45 PM

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'


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

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