Admin

Settings

Updating Wordpress Site Options

This code snippet updates various options for a Wordpress site using the update_option() function. This includes options for the site's title, description, language, timezone, admin email, homepage display, default comment status, and active theme.
This can be useful if you want to quickly update the options for a Wordpress site in a script or during a migration. It eliminates the need to manually update each option through the Wordpress backend.
update_option('blogname', 'Example blog name');
update_option('blogdescription', 'The example blog');
update_option('WPLANG', 'en_AU');
update_option('gmt_offset', '+8');
update_option('admin_email', 'info@example.com');
update_option('show_on_front', 'page');
update_option('page_on_front', 'home');
update_option('default_comment_status', 'closed');
update_option('stylesheet', 'example-theme-child');
update_option('current_theme', 'example-theme-child');
update_option('template', 'example-theme');

This code snippet can be an alternative for updating site options via the plugin like "WordPress SEO by Yoast" and "All in One SEO Pack" etc.
It's important to note that the values passed to the update_option() function should be changed to match the desired settings for the specific Wordpress site.

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.