Skip to content

Instantly share code, notes, and snippets.

View the-sufi's full-sized avatar
🏠
Working from home

the-sufi

🏠
Working from home
View GitHub Profile
@the-sufi
the-sufi / wp-remove-visual-composer-shortcode-from-relevanssi-search-result.php
Created October 6, 2020 04:03
Remove Visual Composer shortcodes from Relevanssi search result
<?php
/**
* When using relevanssi search with visual composer, search results come with some vc_* shortcode.
* Relevanssi by default removes some of the shortcodes. Sometimes theme also include some custom vc shorttcode.
* This code will remove all of those unwanted vc_* shortcodes from search result.
*
* Goes inside functions.php of active theme
*/
add_filter( 'relevanssi_pre_excerpt_content', 'dctit_vc_filtered_content', 99 );
add_filter( 'relevanssi_post_content', 'dctit_vc_filtered_content', 99 );
@the-sufi
the-sufi / wp-remove-guttenburg-block-css.php
Created January 5, 2021 11:38
Remove Gutenberg Block Library CSS from loading on the frontend
<?php
/**
* Remove Gutenberg Block Library CSS from loading on the frontend
*/
function dctit_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-block-style' ); // Remove WooCommerce block CSS
}
add_action( 'wp_enqueue_scripts', 'dctit_remove_wp_block_library_css', 100 );
@the-sufi
the-sufi / wp-disable_plugin_deactivation.php
Created July 30, 2021 02:00
WordPress - Disable option to deactivate Plugin
<?php
/**
* Disable option to deactivate Plugin
*
* @param $actions
* @param $plugin_file
* @param $plugin_data
* @param $context
* @return mixed
*/