server to localhost wordpress code example
Example 1: migrate wordpress to localhost
UPDATE wp_options SET option_value = replace(option_value, 'https://www.example.com', 'http://localhost/mylocalsite') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'https://www.example.com', 'http://localhost/mylocalsite');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://www.example.com','hhttp://localhost/mylocalsite');
Example 2: wordpress https to localhost http
define ('WP_HOME', 'http://localhost/wordpress-folder-name' );
define ('WP_SITEURL', 'http://localhost/wordpress-folder-name' );
For my part, it was different from the other answers. My database was set correctly to http:
So I renamed the folder /wp-content/plugins/really-simple-ssl to something different and it worked.
And to access /wp-admin without SSL, you need to change your /wp-config.php file and set FORCE_SSL_ADMIN to false.