Skip to content

Instantly share code, notes, and snippets.

@taricco
Created March 13, 2024 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taricco/00e11c8ee1af82eecd902977dd362ee4 to your computer and use it in GitHub Desktop.
Save taricco/00e11c8ee1af82eecd902977dd362ee4 to your computer and use it in GitHub Desktop.
/*** Load editor notice for Video CPT
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/
function wsv_video_cpt_notice_script() {
// Ensure we are on the admin screen to prevent errors on the front end
if (is_admin()) {
// Get the current screen object
$screen = get_current_screen();
// Check if the current screen is for the 'video' post type
if ($screen->post_type == 'video') {
wp_enqueue_script('wsv-video-cpt-notice', get_stylesheet_directory_uri() . '/includes/js/wsv_video_cpt_notice.js');
}
}
}
add_action('enqueue_block_editor_assets', 'wsv_video_cpt_notice_script');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment