11 September 2018

Wordpress: Update default page layout for all posts

To update default page layout for all posts, we need to do it in database table wp_postmeta for all post_id's, with next command:

INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT ID, "mom_page_layout", "right-sidebar" FROM wp_posts WHERE post_type = "post" AND post_status = "publish"

After that, all published posts will have desired page layout.

This is also available for event pages, with command :

INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT ID, "mom_page_layout", "right-sidebar" FROM wp_posts WHERE post_type = "event" AND post_status = "publish"

No comments: