Giter VIP home page Giter VIP logo

Comments (6)

elliotcondon avatar elliotcondon commented on July 24, 2024

Hi @djvdorp

Thanks for the bug report.
I'm not able to replicate this from my end, are you able to setup a fresh WP install without an other plugins and see if the issue persists?

from acf.

djvdorp avatar djvdorp commented on July 24, 2024

Hi @elliotcondon

Sorry for the delayed reply. I haven't been able to reproduce the issue somewhere else yet, so it could potentially be related to another plugin or some setting that is off. I want to investigate this further soon!

from acf.

djvdorp avatar djvdorp commented on July 24, 2024

Hi @elliotcondon

We found out that it is likely related to a plugin we're using, vBLink.
Please correct me if we're wrong, but it looks like this could be what is happening:

  • ACF uses a global instance of itself, which somehow gets broken when vBLink is enabled
  • ACF initializes itself in 2 hooks: first when plugins are loaded and then in init
  • it looks like vBLink makes ACF lose the global instance that ACF uses for itself
  • what happens then is that only init is run and not initialize which causes some fields to not be there
  • that results in above error

We were able to find a (horrible) work-around for this, which is rather dirty but works:

[...]

// BEGIN VBLINK CODE
// making a backup so we can reassign values to their originals after it is loaded.
$requestSuperglobals = array($_GET, $_POST, $_REQUEST);
// END VBLINK CODE

// WORKAROUND: Ugly fix for not breaking page save due error in ACF
$saveAcf = $GLOBALS['acf'];

[...]

// BEGIN VBLINK CODE
list($_GET, $_POST, $_REQUEST) = $requestSuperglobals; <-- vBLink code
// END VBLINK CODE

// WORKAROUND: Restore ACF
$GLOBALS['acf'] = $saveAcf;

[...]

Since vBLink is not open source software, I can most likely not paste (all of the) the exact code, but I hope the above description makes sense to you to give you an idea what happens and what goes wrong here.

from acf.

elliotcondon avatar elliotcondon commented on July 24, 2024

Hi @djvdorp

Thanks for the reply and info.

ACF does use a global variable called $acf, and this is initialized at the end of the main acf.php file via the function acf();

I'm not sure why the vBLink plugin would be causing such an issue, but this will definitely be something the developers should be aware of - can you please contact them and let them know?

Thanks
Elliot

from acf.

djvdorp avatar djvdorp commented on July 24, 2024

Hi @elliotcondon

I would love to hit up the vBlink developers and inform them about this, but I am having a very hard time reaching them currently. I mostly wanted to share the workaround here for others right now.
I am closing this issue since I don't think there is much that you (on behalf of ACF) can do about this?

from acf.

sultanboss avatar sultanboss commented on July 24, 2024

After updating to latest ACF, faced same issue and thanks to @djvdorp for the tricky solution :)

from acf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.