This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by Carlos Rojas 4 months ago.

Assigned support staff: Carlos Rojas.

Author Posts
March 2, 2020 at 6:25 pm #5601987

Eduardo Dias

The custom query works for default language, but not for secondary. It redirects to the homepage every time.

March 3, 2020 at 12:01 pm #5607401

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello,
Thank you for contacting WPML support.

1.- Could you provide the documentation to the 'request' hook you are using on the site?
I suspect that the cause of the issue is a missing language filter, however, I need to consult it with our specialists.

2.- Please provide the debug information of the site. In this link, you will find the steps to follow: https://wpml.org/faq/provide-debug-information-faster-support/

Kind regards,
Carlos

March 3, 2020 at 2:12 pm #5608715

Eduardo Dias

Hello,

1 - https://developer.wordpress.org/reference/hooks/request/

This is our function:
function rudr_rewrite_request($query){
if( !is_admin() ) {
$request_uri = urldecode($_SERVER['REQUEST_URI']);
return ['page' => '', 'pagename' => 'homepage', 'popup' => $request_uri];
}
return $query;
}

add_filter( 'request', 'rudr_rewrite_request', 9999, 1 );

2 - The debug information is attached.

Thanks in advance.

March 4, 2020 at 10:23 am #5615251

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hi Eduardo,
Thank you very much for your message.

I'm consulting our specialists about your case and I will get back to you as soon as I have an answer.

Best regards,
Carlos

March 5, 2020 at 10:16 am #5624013

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hi Eduardo,

Our specialists said that you should not return your own array, instead use proper filter to add custom vars https://developer.wordpress.org/reference/hooks/query_vars/

It seems -unfortunately- that for now you need custom programming work which is beyond the scope of our support.

At this point I would suggest you consider contacting one of our certified partners from this link:
http://wpml.org/documentation/support/wpml-contractors/

Before doing so please have a look also here:
http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

You will get the custom assistance you need to get on with your project.

Best regards,
Carlos