Menü schliessen
Created: January 6th 2021
Last updated: February 17th 2021
Categories: IT Development,  Wordpress
Author: Marcus Fleuti

ACF - Advanced Custom Fields - Metaboxes getting emptied after ACF-Export

Tags:  ACF,  function,  metabox,  PHP,  theme,  themeoptions,  wordpress
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

Public information

This is a LEXO internal task and probably won't help your case.

Issue

After trying to export selected ACFs you're getting redirected to our themeoptions page which is empty after the export. This is because we are using metaboxes for our themeoptions. Our custom metaboxes are getting included in the functions.php.

Workaround

If you need to export the ACF-fields anyway there is only a small workaround needed. In the functions.php file, outcomment the include of themeoptions.php. Upload the changes and you are going to see, that the themeoptions aren't available anymore in the WordPress-Backend. Now you are able to download your new custom ACF without any issues. After downloading the ACF make sure to revert the comment you've created in the functions.php. The themeoptions are now available and usable.

/* include("themeoptions.php"); */ --> It looks like this if it is commented out correctly.

Solution

To prevent this error from happening, we need to remove the old themeoptions.php completely because the code is outdated and uses metaboxes. We found out that the metaboxes are interfering our custom ACFs. The themeoptions.php, needs to be implemented with ACF.