Home Forums General Issues get_field returning null after update Reply To: get_field returning null after update

  • I’m not sure how others have ever been able to call an ACF function in plugin before acf/init because when it comes to plugins I have always needed to be more careful.

    The issue with plugins is that you never know in what order plugins will be loaded. The order plugins are loaded changes based on the order that they are activated and it can change when they are updated. Someone might get lucky and not have a problem for a long time and then suddenly one will appear.

    One of the things that surprises me is that so many people have gotten lucky for so long and that it took this change bring them to the surface.

    I have even had this issue in themes where I needed to use an ACF field value before init on the “after_theme_setup” hook where theme options are controlled by acf fields on options pages.

    This goes for other plugins as well, not just ACF. When you are building a plugin that depends on another plugin the earliest that you should do anything that requires the other plugin is on the WP init hook.

    This topic and ones like it where something is not working in a plugin has come up many, many times here so I’ve seen many instances of problems caused by trying to do things too soon.