Skip to content

Instantly share code, notes, and snippets.

@khoipro
Created September 30, 2024 04:16
Show Gist options
  • Save khoipro/28d0a62cfbba43860c38693097567d50 to your computer and use it in GitHub Desktop.
Save khoipro/28d0a62cfbba43860c38693097567d50 to your computer and use it in GitHub Desktop.
Insert data into wp_options without adding option_id

Sample data

INSERT INTO `qUj_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES
('nav_menu_options',	'a:2:{i:0;b:0;s:8:\"auto_add\";a:0:{}}',	'yes'),
('_options_en_US_h_section1_label',	'field_66ac4f4535309',	'off'),
('_options_en_US_h_section1_title',	'field_66ac4f523530a',	'off'),
('_options_en_US_h_section13_preview',	'field_66f15be9ceab9',	'off');

Using VS Code regex replace:

\(\d{1,4},\s

Replace with

(

Then delete a first column import:

`option_id`, 

The final result:

INSERT INTO `qUj_options` (`option_name`, `option_value`, `autoload`) VALUES
('nav_menu_options',	'a:2:{i:0;b:0;s:8:\"auto_add\";a:0:{}}',	'yes'),
('_options_en_US_h_section13_preview',	'field_66f15be9ceab9',	'off');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment