Like this? (This is what I did on the three plugins I thought of that would be affected, and this seems to work).
/////////////////
// INCLUDE ACF //
/////////////////
// Define path and URL to the ACF plugin.
define( 'ELODIN_SECTION_BLOCK_ACF_PATH', plugin_dir_path( __FILE__ ) . 'vendor/acf/' );
define( 'ELODIN_SECTION_BLOCK_ACF_URL', plugin_dir_url( __FILE__ ) . 'vendor/acf/' );
if( !class_exists('ACF') ) {
// Include the ACF plugin.
include_once( ELODIN_SECTION_BLOCK_ACF_PATH . 'acf.php' );
// Customize the url setting to fix incorrect asset URLs.
add_filter('acf/settings/url', 'elodin_sections_block_acf_settings_url');
}
function elodin_sections_block_acf_settings_url( $url ) {
return ELODIN_SECTION_BLOCK_ACF_URL;
}
Oops. I’m an idiot. I have at LEAST one other plugin that uses the same methodology installed on this site. I need to make the update to ALL of those plugins. I’ll try that first; no need to look at this again yet.
So, I think that explanation makes perfect sense – however, even if I comment out the part of the plugin that includes the other version of ACF, then delete the /vendor/acf folder in the plugin (ensuring that only the live version, 5.9.8, is loading), I’m still seeing the issue, so I think it must be something else causing this.
I’d thought that ACF internally already checked if another instance was loaded and ensured that there’s only one version being loaded, no? https://support.advancedcustomfields.com/forums/topic/check-acf-exists-or-not/
Thanks so much for pointing me in the right direction, @lgladdy, and my apologies for hijacking the thread, @hellmute; I thought for sure this was the same issue happening!
For anyone else reading this, an important point that got me confused earlier – ANY plugin that does this incorrectly (as mine all did) can break the site for ALL ACF blocks on the backend. That means if you have multiple plugins that are including ACF, then you’ll need to add a conditional for each of those or have the plugin author do that.
Exactly the same behavior here. Just dropping a note in here to watch the topic. This is the plugin registering the “Section” block that I’m seeing not work properly in 5.9.8, if you need something to replicate the behavior without having to set up any fields manually:
https://github.com/jonschr/elodin-section-block
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.