Background Back when I got my GL-AR150 mini router, I was blown away by the powerful capabilities of this $25 OpenWRT router,...
Batch adding custom field to all posts in WordPressStanislav Khromov
The MySQL query below will add my-custom-field with value “hello” to all published posts.
INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT wp_posts.ID, 'my-custom-field', 0 FROM wp_posts WHERE wp_posts.post_status = 'publish' AND wp_posts.post_type='hello';
Fields that already have custom field my-custom-field will get another one. (So they will have 2 in total.)