From 94e344c6390797ed361ef4dc7b500bdf1288acca Mon Sep 17 00:00:00 2001 From: dustin horton Date: Thu, 21 Jun 2018 04:54:58 -0500 Subject: [PATCH] [gatsby-source-wordpress] Add Node self-cert workaround to README (#6061) * add syntax highlighting to php code blocks * add node self-signed cert workaround --- packages/gatsby-source-wordpress/README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/gatsby-source-wordpress/README.md b/packages/gatsby-source-wordpress/README.md index c78961808cab5..998280232c3e0 100644 --- a/packages/gatsby-source-wordpress/README.md +++ b/packages/gatsby-source-wordpress/README.md @@ -686,7 +686,7 @@ To solve this, you can use the [acf/format_value filter](https://www.advancedcus Using the following function, you can check for an empty field and if it's empty return `null`. -``` +```php if (!function_exists('acf_nullify_empty')) { /** * Return `null` if an empty value is returned from ACF. @@ -708,16 +708,26 @@ if (!function_exists('acf_nullify_empty')) { You can then apply this function to all ACF fields using the following code snippet: -``` +```php add_filter('acf/format_value', 'acf_nullify_empty', 100, 3); ``` Or if you would prefer to target specific fields, you can use the `acf/format_value/type={$field_type}` filter. Here are some examples: -``` +```php add_filter('acf/format_value/type=image', 'acf_nullify_empty', 100, 3); add_filter('acf/format_value/type=gallery', 'acf_nullify_empty', 100, 3); add_filter('acf/format_value/type=repeater', 'acf_nullify_empty', 100, 3); ``` This code should be added as a plugin (recommended), or within the `functions.php` of a theme. + +### Self-signed certificates + +When running locally, or in other situations that may involve self-signed certificates, you may run into the error: `The request failed with error code "DEPTH_ZERO_SELF_SIGNED_CERT"`. + +To solve this, you can disable Node.js' rejection of unauthorized certificates by adding the following to `gatsby-node.js`: + +```javascript +process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' +```