Home › Forums › Gutenberg › Prevent clicks on anchors › Reply To: Prevent clicks on anchors
You haven’t shared the action you’re using to enqueue your script, but I’d double check you’re using admin_enqueue_scripts
and not wp_enqueue_scripts
.
eg:
add_action('admin_enqueue_scripts', 'your_function');
function your_function() {
wp_enqueue_script( 'testJs', get_bloginfo( 'stylesheet_directory' ) . '/js/test.js', array( 'jquery'));
}
I usually achieve this using CSS for ease, but this method will remove hover events too, which you might not want!
In the custom block CSS file:
.acf-block-preview .your-block-name {
pointer-events: none;
}
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.