1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

strip links in wordpress with wp-o-matic

Discussion in 'Blogging' started by jdoe101, Mar 22, 2009.

  1. jdoe101

    jdoe101 Registered Member

    Joined:
    Jan 24, 2009
    Messages:
    56
    Likes Received:
    10
    Hi Guys,

    Quick question, is there anyway to strip links from within wp-o-matic or from wordpress in general?

    I have started an autoblog but there are alot of links in each post that I would rather just not have. Is there anyway that I could edit some code to get rid of this?

    Thanks
     
  2. Laser

    Laser Jr. VIP Jr. VIP Premium Member

    Joined:
    Apr 29, 2008
    Messages:
    822
    Likes Received:
    369
    Occupation:
    internet marketer
    Location:
    Exploiting the Net
    Home Page:
    • Thanks Thanks x 1
    Last edited: Mar 22, 2009
  3. moxer

    moxer Registered Member

    Joined:
    Mar 3, 2008
    Messages:
    96
    Likes Received:
    16
    Occupation:
    Full time Internet Marketer
  4. abantu

    abantu Newbie

    Joined:
    Oct 4, 2008
    Messages:
    11
    Likes Received:
    22
    You can edit the custom-excerpts plugin e.g.

    in custom_excerpts.php Find:

    Code:
    function ce_excerpt_filter($text) {
    	$Length=get_option('ce_length');
    	$MoreText=get_option('ce_moretext');
    	$HTML=get_option('ce_html');
    	$Nofollow=get_option('ce_nofollow');
    
    	$text = get_the_content('');
    	$text = strip_shortcodes( $text );
    
    	$text = apply_filters('the_content', $text);
    	$text = str_replace(']]>', ']]>', $text);
    	$text = strip_tags($text,$HTML);
    	$excerpt_length = apply_filters('excerpt_length', $Length);
    	$words = explode(' ', $text, $excerpt_length + 1);
    	if ($MoreText && count($words)>$Length) {
    		array_pop($words);
    		array_push($words, '<a '.($Nofollow=='Yes' ? 'rel="nofollow" ' : '').'href="'.get_permalink().'">'.$MoreText.'</a>');
    		$text = implode(' ', $words);
    	}
    	return $text;
    }
    And replace it with:

    Code:
    function ce_excerpt_filter($text) {
    
    		$pattern = '/(href|src)=[\'"]?([^\'" >]+)[\'" >]/'; 
    		preg_match_all($pattern, $text, $matches); 
    
    	   		$text = str_replace($matches[2],'',$text);
    			$text = str_replace('</a>','',$text);
    			$text = str_replace('<a','',$text);
    
    	return $text;
    }
    That should get rid of the links
     
    • Thanks Thanks x 1
  5. moxer

    moxer Registered Member

    Joined:
    Mar 3, 2008
    Messages:
    96
    Likes Received:
    16
    Occupation:
    Full time Internet Marketer
    Thanks first, I'll try it.
     
  6. moxer

    moxer Registered Member

    Joined:
    Mar 3, 2008
    Messages:
    96
    Likes Received:
    16
    Occupation:
    Full time Internet Marketer
    don't work, sorry ...
     
  7. jdoe101

    jdoe101 Registered Member

    Joined:
    Jan 24, 2009
    Messages:
    56
    Likes Received:
    10
    Another more simple method that I am now using:

    In wp-o-matic campaign options click on rewrite.

    Rewrite:
    sourceblog.com

    rewrite to:
    yourblog.com

    that way all links will redirect to your site.

    Obviously I cant post links yet so you do want to add http to it before.