Giter VIP home page Giter VIP logo

Comments (7)

saulirajala avatar saulirajala commented on August 27, 2024 4

Nice work, 6.1.2 update seems to fix the issue in our case 🚀

from acf.

mattgrshaw avatar mattgrshaw commented on August 27, 2024 4

Hey folks, thanks for the reports on this one.

As mentioned earlier in the thread we released ACF 6.1.2 today, which should resolve most if not all of these issues.

We do still recommend registering things like field groups and options pages inside the acf/init hook if possible, so we're going to update our documentation and the ACF PHP export code to reflect this.

from acf.

eyetractive avatar eyetractive commented on August 27, 2024 2

I can confirm that something has changed. Our hooks added to "acf/init" are not working anymore, at all.

This is a bug? Or an intended, but undocumented change?!

from acf.

nicmare avatar nicmare commented on August 27, 2024

thanks for the report. this should to the trick right?

add_action("acf/init",function(){
if( function_exists('acf_add_local_field_group') ):
	
	acf_add_local_field_group(array(
		'key' => 'group_639ca3bf19def',
		'title' => 'Block: Content-Block',
		'fields' => array(
			array(
				'key' => 'field_639ca3bfbbaba',
				'label' => 'Content-Block',
				'name' => 'content-block',
				'aria-label' => '',
				'type' => 'select',
				'instructions' => 'Inhalte <a href="edit.php?post_type=ct_content_block" target="_blank">hier anlegen / ändern</a>',
				'required' => 0,
				'conditional_logic' => 0,
				'wrapper' => array(
					'width' => '',
					'class' => '',
					'id' => '',
				),
				'choices' => array(
					1701 => 'Wetter',
					1334 => 'Öffnungszeiten',
				),
				'default_value' => false,
				'return_format' => 'value',
				'multiple' => 0,
				'allow_null' => 0,
				'ui' => 0,
				'ajax' => 0,
				'placeholder' => '',
			),
		),
	));

endif;
});

from acf.

SchwartzN avatar SchwartzN commented on August 27, 2024

I can confirm that something has changed. Our hooks added to "acf/init" are not working anymore, at all.

This is a bug? Or an intended, but undocumented change?!

We have the same issue here, our function that registers block_type are never called by the hook on acf/init.
It was working fine on 6.0.7 but it's broken since 6.1

from acf.

saulirajala avatar saulirajala commented on August 27, 2024

We also have the same issue. It seems that every add_action( 'acf/init', function(){} ) -call in our theme does actually nothing, since ACF has already triggered acf/init-hook before theme executes add_action(). I think the reason is this change in acf_add_local_field_group() -function in 6.1.1 update.

Depending on how and where you run acf_add_local_field_group() -functions, this can create race-condition situation where acf_add_local_field_group() (and thus acf_init() and thus do_action('acf/init') ) is executed before add_action( 'acf/init', function(){} ) is executed in theme.

For example, we had following code in mu-plugin:

add_action( 'plugins_loaded', function () {
	if ( function_exists( 'acf_add_local_field_group' ) ) :
		acf_add_local_field_group( $args );
	endif;
} );

When we changed it to use acf/init instead of plugins_loaded -hook, everything seems to be working fine.

However, the same issue occurs also, if I follow the official documentation and add acf_add_local_field_group() straight to the functions.php of theme. So I'm not sure whether or not this is issue with ACF or just how we use ACF 🤔 Nevertheless at least the docs should be changed so that acf_add_local_field_group() is always inside of acf/init -hook in every code examples.

from acf.

3ele-projects avatar 3ele-projects commented on August 27, 2024

Thank you very much.

I.e. you recognise it as a bug and I don't have to change my code and should wait for the update?

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.