From d026cebf917a96df4c535692998cea7d6bfa239b Mon Sep 17 00:00:00 2001 From: HerrVigg Date: Wed, 14 Aug 2019 13:52:13 +0200 Subject: [PATCH] Fix media library broken with ACF 5.8.3 (#718) --- modules/acf/src/acf_5/fields/image.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/acf/src/acf_5/fields/image.php b/modules/acf/src/acf_5/fields/image.php index 5b71a185..f2727a72 100644 --- a/modules/acf/src/acf_5/fields/image.php +++ b/modules/acf/src/acf_5/fields/image.php @@ -71,8 +71,11 @@ function initialize() { // filters - add_filter('get_media_item_args', array($this, 'get_media_item_args')); - add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3); + add_filter('get_media_item_args', array($this, 'get_media_item_args')); + // removed from ACF 5.8.3 + if (method_exists($this, 'wp_prepare_attachment_for_js')) { + add_filter('wp_prepare_attachment_for_js', array($this, 'wp_prepare_attachment_for_js'), 10, 3); + } }