server-command
server-command copied to clipboard
Server on `http://` returns `https://` links
If you have site on https and run php server on http the function get_site_icon_url return a link with https.
I think the problem here https://github.com/WordPress/WordPress/blob/master/wp-includes/general-template.php#L810, because WordPress should use here get_site_url() instead get_option( 'site_icon' ).
Maybe we can add filter on get_site_icon_url to fix it problem or we should fix it in WordPress?
Same problem for wp_upload_dir so all images have https, maybe we can add more filters here https://github.com/wp-cli/server-command/blob/master/router.php?
Worth noting that get_option( 'site_icon' ) just holds the ID of the site icon, not its URL. The actual URL is generated by wp_get_attachment_image_url() and then wp_get_attachment_url(), which uses the image URL stored in the attachment metadata in the database.
So the right filter in that case would probably be wp_get_attachment_url.
@swissspidy yep, i find what wp_get_attachment_url use wp_upload_dir for getting host, so i think filter should in wp_upload_dir, it is fix all images urls
I'm not sure this can be easily solved. You still have all the links that are stored throughout post content fields that point to https://.
Maybe a better approach would be to add a flag --adapt-scheme that filters the actual output to replace all https:// links pointing to the local server with http:// links?
@schlessera we rewrite url in production, but for development mode will be great have valid url