• Resolved fredsbend

    (@fredsbend)


    My wp_posts table has two columns that Really Simple CSV will not update. Those columns are called group_access and tag_list. I create the columns in the CSV, but the importer will not update those fields in the wp_posts table. How can I get it to target these fields?

    • This topic was modified 8 years ago by fredsbend.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter fredsbend

    (@fredsbend)

    I’ve edited the plugin php directly with the following code. It was able to update those fields now:

    				// (string, comma separated) group access
    				$group_access = $h->get_data($this,$data,'group_access');
    				if ($group_access) {
    					$post['group_access'] = $group_access;
    				}
                      echo $group_access;
                      echo ' ';
    
    				// (string, comma separated) tag list
    				$tag_list = $h->get_data($this,$data,'tag_list');
    				if ($tag_list) {
    					$post['tag_list'] = $tag_list;
    				}
                      echo $tag_list;
    
    global $wpdb;
    $dbresult = $wpdb->update($wpdb->posts, ['group_access' => $group_access, 'tag_list' => $tag_list], ['ID' => $post_id]);
    if (false === $dbresult) {
        echo 'An error occurred while updating...';
        $errors = $post_id->get_error_messages();
    }

    It does not edit the fields if creating a new entry. I’m working on it. In the meantime, I just import twice, the first to create the rows, the second to make the updates to these specific fields.

    It would be great if the plugin author would add the functionality for the importer to account for user specific fields, instead of just the default WP fields.

    • This reply was modified 8 years ago by fredsbend.
    • This reply was modified 8 years ago by fredsbend.
    Plugin Author Takuro Hishikawa

    (@hissy)

    I recommend you do not change structure of database of WordPress Core, using custom field is always safety way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot update specific fields’ is closed to new replies.