Cusdtom WP escape

function my_plugin_kses( $html ) { $kses_defaults = wp_kses_allowed_html( ‘post’ ); $svg_args = array( ‘svg’ => array( ‘class’ => true, ‘aria-hidden’ => true, ‘aria-labelledby’ => true, ‘role’ => true, ‘xmlns’ => true, ‘fill’ => true, ‘width’ => true, ‘height’ => true,…Continue reading

Allow HTML in Term (Category, tag) Descriptions

foreach (array(‘pre_term_description’) as $filter) { remove_filter($filter, ‘wp_filter_kses’); if (!current_user_can(‘unfiltered_html’)) { add_filter($filter, ‘wp_filter_post_kses’); } } foreach (array(‘term_description’) as $filter) { remove_filter($filter, ‘wp_kses_data’); }Continue reading

Support for WebP Images

function g9_mime_types($mime_types) { $mime_types[‘webp’] = ‘image/webp’; //Adding webp extension return $mime_types; } add_filter(‘woocommerce_rest_allowed_image_mime_types’, ‘g9_mime_types’, 1, 1);Continue reading

Page Slug Body Class

function g9_add_slug_body_class($classes) { global $post; if (isset($post)) { $classes[] = $post->post_type . ‘-‘ . $post->post_name; } return $classes; } add_filter(‘body_class’, ‘g9_add_slug_body_class’);Continue reading

Get Post Terms with [g9_post_terms] Shortcode

function g9_get_post_terms() { global $post; ob_start(); $taxonomy_name = ‘category’; // Taxonomy name $terms = get_the_terms($post->ID, $taxonomy_name); if ($terms) : $term_links = array(); foreach ($terms as $term) { $term_links[] = ‘Continue reading