This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: slug problem

#33386
Ernest MarcinkoErnest Marcinko
Keymaster

Thanks!

Okay, so I debugged through this, and found absolutely nothing at all. No matter what I do, always the incorrect link is returned. I don’t know if this is an issue with WordPress or WPML or there is something else conflicting, but for now I could only come up with a custom coded solution:

add_filter('asp_results', 'asp_change_wpml_link_users', 10, 4);
function asp_change_wpml_link_users( $results, $id, $is_ajax, $args ) {
	$replace = array(
		'tr' => '/uzmanlar/'
	);
	if ( $args['_wpml_lang'] != '' && isset($replace[$args['_wpml_lang']]) ) {
		foreach ( $results as $k => &$r ) {
			if ( $r->content_type == 'user' ) {
				$r->link = str_replace('/members/', $replace[$args['_wpml_lang']], $r->link);
			}
		}
	}
	return $results;
}

I palced this to the functions.php, it is in effect now.

This will replace the incorrect string with the correct one for the turkish site. The problem is very likely a bug somewhere else, I assume it is most likely WPML, but I don’t want to point any fingers, because I don’t know much. Unfortunately I can not guarantee this is going to work in all cases.