Remove Unused JS

/** * We will Dequeue the jQuery UI script as example. * * Hooked to the wp_print_scripts action, with a late priority (99), * so that it is after the script was enqueued. */ function wp_remove_scripts() { // check if…Continue reading

Explicit Fixed Width and Height

add_filter( ‘the_content’, ‘add_image_dimensions’ ); function add_image_dimensions( $content ) { preg_match_all( ‘/]+>/i’, $content, $images); if (count($images) < 1) return $content; foreach ($images[0] as $image) { preg_match_all( '/(alt|title|src|width|class|id|height)=("[^"]*")/i', $image, $img ); if ( !in_array( 'src', $img[1] ) ) continue; if ( !in_array(…Continue reading

Remove Gutenberg Block CSS

//Remove Gutenberg Block Library CSS from loading on the frontend function smartwp_remove_wp_block_library_css(){ wp_dequeue_style( ‘wp-block-library’ ); wp_dequeue_style( ‘wp-block-library-theme’ ); } add_action( ‘wp_enqueue_scripts’, ‘smartwp_remove_wp_block_library_css’ );Continue reading

MemberPress: Remove Accordion from Courses

function mepr_remove_accordion_class( $classes ) { //Course class body $cs_index = array_search( ‘mpcs-course-with-accordion’, $classes ); if ( isset( $cs_index ) ) { unset( $classes[$cs_index] ); } //Sidebar class body $sb_index = array_search( ‘mpcs-sidebar-with-accordion’, $classes ); if ( isset( $sb_index ) )…Continue reading