[英]Local WordPress & MAMP wp_remote_get(): cURL error 60: SSL certificate problem: unable to get local issuer certificate
I have a site running locally on MAMP Pro (macos) and keep getting cURL errors when I use wp_remote_get()
我有一个在 MAMP Pro (macos) 上本地运行的站点,并且在使用
wp_remote_get()
时不断收到 cURL 错误
I've searched and tried multiple solutions, but nothing seems to work.我已经搜索并尝试了多种解决方案,但似乎没有任何效果。
My code:我的代码:
$url = site_url() . '/wp-json/wp/v2/my-cpt'; // This works just fine and shows up in the browser correctly
$response = wp_remote_get( $url ); // this outputs the cURL error: "cURL error 60: SSL certificate problem: unable to get local issuer certificate"
I have:我有:
This is more of a local work around.这更像是一种本地解决方法。 You can disable SSL verification within your local site.
您可以在本地站点中禁用 SSL 验证。 This can be accomplished by adding this line into the file
wp-includes/functions.php
or /wp-content/themes/YOUR_THEME/functions.php
这可以通过将此行添加到文件
wp-includes/functions.php
或/wp-content/themes/YOUR_THEME/functions.php
add_filter('https_ssl_verify', '__return_false');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.