Last active
May 18, 2021 12:37
-
-
Save EdwardBock/939c5a8e084bfa11f39345042c64f3b6 to your computer and use it in GitHub Desktop.
DON'T: Gutenberg add script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace PublicFunctionOrg\WordPress\Gutenberg; | |
const HANDLE = "my-gutenberg-script"; | |
add_action( 'enqueue_block_editor_assets', function () { | |
wp_enqueue_script( | |
HANDLE, | |
plugin_dir_url(__FILE__) . "/js/my-gutenberg-script.js", | |
['wp-data', ...], | |
filemtime(plugin_dir_path(__FILE__)."/js/my-gutenberg-script.js") | |
); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment