diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ef965cd
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,7 @@
+FROM wordpress:5.5
+
+COPY ./entrypoint.sh /usr/local/bin/apache2-custom.sh
+RUN chmod 755 /usr/local/bin/apache2-custom.sh
+RUN chmod +x /usr/local/bin/apache2-custom.sh
+
+CMD [ "apache2-custom.sh" ]
diff --git a/docker-compose.yml b/docker-compose.yml
index fe290c3..0db3d2c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,9 +1,10 @@
-version: "3.1"
+version: "3.2"
services:
wordpress:
- image: wordpress
+ build: .
restart: always
+ container_name: wordpress
ports:
- 8080:80
environment:
@@ -20,6 +21,7 @@ services:
db:
image: mysql:5.7
restart: always
+ container_name: mysql
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755
index 0000000..073daaa
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+cd /var/www/html
+
+WPPATH=/var/www/html
+
+echo "- Fix permissions";
+echo "=====================================";
+chown -R www-data:www-data $WPPATH
+
+echo "- Install WP CLI";
+echo "=====================================";
+curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
+php $WPPATH/wp-cli.phar --info
+chmod +x wp-cli.phar
+mv $WPPATH/wp-cli.phar /usr/local/bin/wp
+
+echo "- Install and activate required plugins";
+echo "=====================================";
+wp plugin install advanced-custom-fields --activate --path=$WPPATH --allow-root
+wp plugin install acf-to-rest-api --activate --path=$WPPATH --allow-root
+wp plugin activate nullify-empty-fields-for-acf --path=$WPPATH --allow-root
+
+echo "- Add a development user";
+echo "=====================================";
+wp user create dev dev@admin.user --role=administrator --user_pass=password --path=$WPPATH --allow-root
+
+echo "- Start apache";
+echo "=====================================";
+exec "apache2-foreground"
diff --git a/src/index.php b/src/index.php
index 121f1b7..53d2a58 100644
--- a/src/index.php
+++ b/src/index.php
@@ -4,7 +4,7 @@
* Plugin URI: https://github.com/jabranr/nullify-empty-fields-for-acf
* Description: Set Advanced Custom Fields (ACF) empty field value as null
instead of false
to avoid GraphQL error in GatsbyJS.
* Author: Jabran Rafique
- * Version: 1.1.0
+ * Version: 1.2.0
* Author URI: https://jabran.me?utm_source=nullify-empty-fields-for-acf
* License: MIT License
*
@@ -85,9 +85,9 @@ function nullify_empty_fields_for_acf_toggle($remove = false) {
foreach($nullifyTypes as $nullifyType) {
if ($remove) {
- remove_filter('acf/format_value/type=' . $nullifyType, 'nullify_empty_fields_for_acf_empty', 100, 3);
+ remove_filter('acf/format_value/type=' . trim($nullifyType), 'nullify_empty_fields_for_acf_empty', 100, 3);
} else {
- add_filter('acf/format_value/type=' . $nullifyType, 'nullify_empty_fields_for_acf_empty', 100, 3);
+ add_filter('acf/format_value/type=' . trim($nullifyType), 'nullify_empty_fields_for_acf_empty', 100, 3);
}
}
}
diff --git a/src/readme.txt b/src/readme.txt
index 35accf0..8cbf727 100644
--- a/src/readme.txt
+++ b/src/readme.txt
@@ -3,8 +3,8 @@ Contributors: jabranr
Donate link: https://paypal.me/jabranr
Tags: gatsby, graphql, acf, advanced-custom-fields, wordpress
Requires at least: 5.0
-Tested up to: 5.3.2
-Stable tag: 1.1.0
+Tested up to: 5.5
+Stable tag: 1.2.0
Requires PHP: 7.1
License: MIT License
License URI: https://opensource.org/licenses/MIT
@@ -27,6 +27,10 @@ Set Advanced Custom Fields (ACF) empty field value as `null` instead of `false`
== Changelog ==
+= 1.2.0 =
+* Compatibility for WordPress 5.5
+* Bugfix where default value was not being applied to all ACF field types
+
= 1.1.0 =
* Support for Advanced Custom Fields (PRO)