Home › Forums › ACF PRO › ACF6 + register_block_type + assets › Reply To: ACF6 + register_block_type + assets
I’m having trouble too, I’ve tried the suggested stuff on wordpress.org which seems to be to use wp_register_script
instead of wp_enqueue_script
– the difference being that it registers it but doesnt load it. Then you call it within the block.json file referencing the handle see here
So add your wp_register_script
in a enqueue_block_editor_assets
action eg.
add_action( 'enqueue_block_editor_assets', function(){
wp_register_script( 'block-qb-daterange', get_template_directory_uri() . '/script-url-here.js', array(''), null, true );
});
then in block.json you can use script
for global (front and admin) or editorScript
key for just loading into the editor, basically anything on that link earlier
{
"script": "block-qb-daterange",
}
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.