I need to implement a plugin update process that changes the database from the backend in one language only when the query runs.
Here is a brief description of what I am trying to do:
Because WPML stores the speech information for the post in a separate wp_icl_translations table, and we need a slightly complex query to filter the posts, we combine the wp_posts and wp_icl_transaltion to get the result. I use WPML language codes for each language, en for English, It for Italian, etc. in a field to select the language.
I wrote the plugin page, the only thing I get stuck with is that the database function is not running!
I used wpdb like this:
global $ wpdb;
$ wpdb-> update (wp_posts INNER JOIN wp_icl_translations t ON wp_posts.ID = t.element_id AND t.element_type = CONCAT (& # 39; post_ & # 39 ;, wp_posts.post_type) set post_content = replace (post_content, & # 39; Energy & # 39 ;, & # 39; Energyka & # 39;) WHERE wp_posts.post_type = & product; & 39; & wp_posts.post_status = & # 39; publish & # 39; AND ((t.language_code = & # 39 ; ka & nbsp; wp_posts.post_type = & gt; product & gt;)))
Once the above query is executed in SQL Phpmyadmin, Energy will be replaced by Energyka in Kannada language
But I have created these two words from different languages as fields, also as language fields and as Post Type Slug, which the user can enter at his own choice.
So I would like the above code to update the database when the form is submitted, after these fields have been filled out.
I would be very happy about any help.