Old snippets no longer allow editing after update
-
After updating recently and having to update a snippet, I noticed despite it saying my changes were saved, the snippet upon reload showed the changes were not saved.
After reviewing the changes made by the most recent update, I believe it’s because of the following added database fields in the code were not added to the database. Why it’s not erroring on save but rather shows it was updated successfully, I’m not sure as I turned off auto-handling of errors (however, this might be related to the snippet execution itself).
I’ve highlighted the changes below which were made to the
snippet-edit.php
file. None of the referenced columns exist in the database table for this plugin (wp_xyz_ips_short_code).- $wpdb->update($wpdb->prefix.'xyz_ips_short_code', array('title'=>$xyz_ips_title,'content'=>$xyz_ips_content,'short_code'=>$xyz_shortCode,), array('id'=>$xyz_ips_snippetId));
+ $wpdb->insert($wpdb->prefix.'xyz_ips_short_code', array('title' =>$xyz_ips_title,'insertionMethod' => $xyz_ips_insertionMethod, 'insertionLocation' => $xyz_ips_insertionLocation, 'insertionLocationType' => $xyz_ips_insertionLocationType,'content'=>$xyz_ips_content,'short_code'=>$xyz_shortCode,'status'=>'1'),array('%s','%d','%d','%d','%s','%s','%d'));
I will attempt to fix this by either adding the columns (if I can figure out what data types they should be) or rolling back the update.
- This topic was modified 3 weeks, 3 days ago by . Reason: Added previous code indicated by local git repo changes
- This topic was modified 3 weeks, 3 days ago by .
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.