The parent theme’s functions.php
will load automatically. You don’t need to “read” it, and you don’t want to “hack” it either manually, which will be overwritten, or programatically, which is very resource intensive.
Your theme is enqueueing the script on the wp_head
action. You just need to remove that callback and add a slightly modified one. The trick is that your child theme’s functions.php
loads after your parent functions.php
so you need to get the timing right.
function dequeue_dt_specific_enqueues() {
remove_action('wp_head', 'dt_specific_enqueues');
}
add_action('after_setup_theme', 'dequeue_dt_specific_enqueues');
Then add back your own version:
function altered_dt_specific_enqueues() {
if (is_single()) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action('wp_head', 'altered_dt_specific_enqueues');