如何加入协议相对的外部(//ajax.googleapis.com/…)脚本?
根据食品法典,wp_enqueue_script支持相对于协议或与协议无关的外部链接:“可以使用与协议无关的URL,即'//otherdomain.com/js/theirscript.js',来指定远程资产。” 但我没有看到它: wp_enqueue_script('google-maps', '//maps.googleapis.com/maps/api/js?&sensor=false', array(), '3', true); 输出: <script type='text/javascript' src='http://localhost:25898//maps.googleapis.com/maps/api/js?sensor=false&#038;ver=3'></script> 请注意,协议相对URL附加到站点URL。