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 8 replies, has 3 voices.
Last updated by Carlos Rojas 4 years, 3 months ago.
Assisted by: Carlos Rojas.
| Author | Posts |
|---|---|
|
May 11, 2022 at 2:24 pm
#11200483
|
|
|
I am trying to: Link to a page where the issue can be seen: I expected to see: Instead, I got: |
|
|
May 11, 2022 at 5:51 pm
#11202043
|
|
|
Laura WPML Supporter since 05/2018
Languages: English (English ) Italian (Italiano ) Timezone: Europe/Rome (GMT+02:00) |
Hi, thanks for contacting us. Please enable the WordPress debug log. This will allow us to see if any PHP errors are being produced. More Info: https://codex.wordpress.org/Debugging_in_WordPress Edit wp-config.php and insert the following lines: define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); Browse to the page with the issue and/or reproduce the issue. Locate the debug log in: /wp-content/debug.log Paste the latest lines here. No need to paste the entire log file, just 50 lines or so will do. Please censor any sensitive information. |
|
May 11, 2022 at 5:57 pm
#11202059
|
|
|
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Hello, Could you share the information requested by my colleague on the previous message? Regards, |
|
May 11, 2022 at 6:41 pm
#11202187
|
|
|
This is the error that appears in the logs: |
|
|
May 12, 2022 at 10:59 am
#11207155
|
|
|
Carlos Rojas Supporter |
Hello, I kindly ask you to follow these steps in order to isolate the cause of the issue: Could you tell me the results of the steps described above? Regards, |
|
May 13, 2022 at 11:47 am
#11216351
|
|
|
The issue is in a function that gets all pages from all functions. We save the current language and after processing we set the language back to normal.
$current_lang = apply_filters( 'wpml_current_language', NULL );
$languages = apply_filters( 'wpml_active_languages', NULL, array( 'skip_missing' => 0));
foreach( (array) $languages as $lang ) {
do_action( 'wpml_switch_language', $lang['code'] );
/* building query */
$posts = new \WP_Query( [
'sort_order' => 'ASC',
'sort_column' => 'post_title',
'post_type' => 'page',
'posts_per_page' => -1,
'post_status' => 'publish',
] );
// Processing fetched posts.
}
do_action( 'wpml_switch_language', $current_lang );
Do you have an idea why this code produces such an error? Any hints would be much appreciated |
|
|
May 13, 2022 at 2:03 pm
#11217887
|
|
|
Carlos Rojas Supporter |
Hello, In this case, you will need custom coding which falls outside of the scope of our support service. I would recommend you to contact one of our certified partners at this link: https://wpml.org/contractors/ they will be more than happy to help you. Regards, |
|
May 16, 2022 at 7:10 am
#11226557
|
|
|
My issue is resolved now. We found the issue in our code. We resolved the issue by altering our query. |
|
|
May 16, 2022 at 2:04 pm
#11230491
|
|
|
Carlos Rojas Supporter |
Hi there, I'm glad to hear that the issue is solved 🙂 Please don't hesitate to contact us if you need our help in the future with WPML. We will be more than happy to help. |
