Last active
February 3, 2021 12:09
-
-
Save irkanu/d0ea80ca3a30416a044c to your computer and use it in GitHub Desktop.
Dequeue LearnDash scripts on the homepage.
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
/** | |
* 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