Skip to content

Instantly share code, notes, and snippets.

@irkanu
Last active February 3, 2021 12:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irkanu/d0ea80ca3a30416a044c to your computer and use it in GitHub Desktop.
Save irkanu/d0ea80ca3a30416a044c to your computer and use it in GitHub Desktop.
Dequeue LearnDash scripts on the homepage.
/**
* Remove the LearnDash related scripts / styles from the homepage.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_learndash_styles', 99 );
function child_manage_learndash_styles() {
// Check if LearnDash exists to prevent fatal errors.
if ( class_exists( 'SFWD_LMS' ) ) {
// Make sure we are on the front page.
if ( is_front_page() ) {
// Remove all scripts and styles enqueued by LearnDash.
wp_dequeue_style( 'learndash_style' );
wp_dequeue_style( 'sfwd_front_css' );
wp_dequeue_style( 'date-picker-css' );
wp_dequeue_style( 'wpProQuiz_front_style' );
wp_dequeue_style( 'sfwd_template_css' );
wp_dequeue_script( 'sfwd_template_js' );
wp_dequeue_script( 'sfwd-module-script' );
remove_filter( 'the_content', 'learndash_the_content_load_resources' );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment