WordPress.org

Ready to get started?Download WordPress

Forums

qTranslate META
quick edit makes losing all meta data (3 posts)

  1. pompos
    Member
    Posted 1 year ago #

    Just recognized that using the quick edit feature results losing the meta title and description for the pages in my version (0.8.5). Is there any fix existing for that issue in some latest version?
    Thanks in advance!

    http://wordpress.org/extend/plugins/qtranslate-meta/

  2. winnings.com
    Member
    Posted 1 year ago #

    at 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 names

    and 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 names

    I hope it helps :)

  3. pompos
    Member
    Posted 1 year ago #

    Thanks winnings.com :) your solution is working fine!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags