Open
If you have a multilingual site and you split a custom search View so that the search form displays on one page and the results on another, if you initiate the search on a secondary language page, the results will display on the default language page instead of persisting in the secondary language.
This only happens if you are using the WPML Sticky Links plugin.
You can add the following code snippet (at Toolset > Settings > Custom Code) to prevent Sticky Links from modifying URLs for certain pages.
In this example, if we display our search results on a page whose slug (in a secondary language) is ‘search-results’ then we can add the ‘search-results’ slug to a blacklist of URLs Sticky Links should ignore, like so:
add_filter( 'wpml_sl_blacklist_requests', 'fix_wpml_sl_blacklist_requests', 10, 2 );
function fix_wpml_sl_blacklist_requests( $blacklist, $sitepress ) {
$blacklist[] = 'search-results';
return $blacklist;
}