PHP: change search string in Wordpress filter

Hi PHP help.

I have a Wordpress filter that redirects links on tags and redirects them to a different domain. What I want to do is get the filter to search the other domain for that word

This is what I have at the moment

[php]add_filter( ‘term_links-post_tag’, ‘replace_tag_domain’, 100 );

function replace_tag_domain( $links ) {

// What to find in the link
$find = home_url();

// What to replace it with
$replace_with = '';

foreach( $links as $k => $link )
// Run string replacement
    $links[$k] = str_replace( $find, $replace_with, $link );

// Return the modified tag link
return $links;


What I need to do is replace the word “dish” in the code below with the tag $link. Is it possible?

So the $replace_with = ‘’;

needs to be replaced with:

then the $link followed by


the line:$link&I_DSC_AND=t&_ACT=search

won’t work due to my terrible knowledge of php.

Is there some alternative?

Try this
[php]‘’ . $link . ‘&I_DSC_AND=t&_ACT=search’[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service