winnings.com
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [qTranslate META] quick edit makes losing all meta dataat our website winnins.com we use the plugin and found it’s really valuable and useful to meet our needs. Recently bumped the same issue and added a quick fix to the plugin.
The reason of losing meta tags when saving with quick edit is quite simple just take a look at the function hook_save_post()
it assigns the meta values from the $POST variable but quick edit form doesn’t have any fields with meta values.
Here’s how we fixed and proven to be a working solution:
find this part in the function function hook_save_post($post_id)foreach($this->field_names as $field => $field_label) { //Get field data $field_id = "qtrans_meta_{$field}_{$lang}"; $field_data = trim(str_replace('"', '', $_POST[$field_id])); $meta[$field][$lang] = $field_data; } //end of iterating over field namesand add a condition to check if there’s $_POST data for the fields:
foreach($this->field_names as $field => $field_label) { //Get field data $field_id = "qtrans_meta_{$field}_{$lang}"; if (isset($_POST[$field_id])) { // fix to avoid losing metadata with quick edit $field_data = trim(str_replace('"', "'", $_POST[$field_id])); $meta[$field][$lang] = $field_data; } } //end of iterating over field namesI hope it helps 🙂
Viewing 1 replies (of 1 total)