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.

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Itamar 3 months ago.

Assigned support staff: Itamar.

Author Posts
June 7, 2018 at 3:57 pm #2397171

Brent

We get this error for certain type of requests.
WordPress database error Unknown column 't.language_code' in 'where clause

To reproduce this on fresh WP/WPML of the latest versions, you need to create at least one taxonomy, e.g. type.
Then the request to hidden link would produce the WP DB error.
We get quite many requests like that from Bing bot for whatever reason, that produce the errors.

The problem is that is_tax returns true, but WP fails to return the post_types, thus JOIN is not added, but WHERE gets reference to t.language_code, and then fails around
wp-includes/class-wp-query.php:2942
$ids = $wpdb->get_col( $this->request );

In WPML around wp-content/plugins/sitepress-multilingual-cms/classes/query-filtering/wpml-query-filter.class.php:103

$post_type ands up being empty, because $query->is_tax is true, but $this->get_tax_query_posttype returns empty array.

We'll fix it by filtering the request to remove the leading comma, but just though you might address the issue.

June 10, 2018 at 6:28 pm #2403894

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi and thanks for reporting this.

I'm not sure how to reproduce this.
Can you please elaborate further on this issue?
What type of taxonomy are you using?
Is it regular posts category or maybe tag, or other?
What do ',one,two' represent in the request?

To ensure the quickest and most accurate support, please provide your debug information so that I can get a look at some of your configurations.
We have an excellent article on how to located here: https://wpml.org/faq/provide-debug-information-faster-support/.

Thanks,
Itamar.

June 11, 2018 at 2:20 pm #2405333

Brent

Any custom taxonomy would be fine, as long as it is not post_tag or category (those two are not returning is_tax() == true).
"?type=,one,two" is the url that will produce the DB error. one and two might be existing term or not, type is the slug of your custom taxonomy that you need to create either via functions, or using types toolkit. Actually, if you just use any site that already has custom taxonomy and use the value of the terms that start with comma, you will see a DB error.
As long as custom taxonomy url parameter starts with comma, it will produce DB error.

June 11, 2018 at 8:21 pm #2406343

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi and thanks for the extra details.

I'm consulting our second tier supporters about this issue.
We'll keep you updated here.

Regards,
Itamar.

June 13, 2018 at 10:17 am #2410680

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

This ticket is now escalated to our second tier supporter, and they will check this issue with our developers.
We'll keep you updated on this issue here in the ticket.

Best Regards,
Itamar.

July 21, 2019 at 2:58 pm #4252617

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

I'm sorry for not getting to you here for such a long time. This issue is rather old. If for any reason it persists with the latest versions of WPML and its add-ons then please open a new ticket in our forum regarding this issue or any other WPML issue for that matter.

Best Regards,
Itamar.