php - WordPress: Append referral link to all urls for a specific site -


i need append referral id outgoing links specific site.

i have in posts links google.com/ , i'd set function have google.com/?ref=123

any suggestions?

i tried edit this

add_filter('wp_insert_post_data', 'new_content' );     function new_content($content) {     $my_folder =  "http://example.com/recommends/";     preg_match_all('~<a.*>~isu',$content["post_content"],$matches);     ( $i = 0; $i <= sizeof($matches[0]); $i++){         if ( !preg_match( '~nofollow~is',$matches[0][$i])             && (preg_match('~' . $my_folder . '~', $matches[0][$i])                 || !preg_match( '~'.get_bloginfo('url').'~',$matches[0][$i]))){             $result = trim($matches[0][$i],">");             $result .= ' rel="nofollow">';             $content["post_content"] = str_replace($matches[0][$i], $result, $content["post_content"]);         }     }     return $content; } 

``

but had no result..


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -