Remove Open Sans from Twenty Twelve theme

Found the answer here:

Script dequeuing calls should be added to the wp_print_scripts action
hook(..). This is because scripts are typically enqueued on the
wp_enqueue_script hook, which happens early in the wp_head process.
The wp_print_scripts hook happens right before scripts are printed,
and thus is latest in the process. (Otto)

Following the same logic we can use wp_print_styles to remove the Open Sans font:

function remove_open_sans() {
   wp_dequeue_style( 'twentytwelve-fonts' );
}
add_action('wp_print_styles','remove_open_sans');

This did the trick.

Leave a Comment