WordPress Content Filter: Removing Tags for Enhanced Display Control
function remove_noscript_tags($html) { return preg_replace(‘/(.*?)/is’, ”, $html); } add_filter(‘the_content’, ‘remove_noscript_tags’);Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
function remove_noscript_tags($html) { return preg_replace(‘/(.*?)/is’, ”, $html); } add_filter(‘the_content’, ‘remove_noscript_tags’);Continue reading
/** * Enables the HTTP Strict Transport Security (HSTS) header in WordPress. * Includes preloading with subdomain support. */ function tg_enable_strict_transport_security_hsts_header_wordpress() { header( ‘Strict-Transport-Security: max-age=31536000; includeSubDomains; preload’ ); } add_action( ‘send_headers’, ‘tg_enable_strict_transport_security_hsts_header_wordpress’ );Continue reading
add_action( ‘wp_enqueue_scripts’, function () { wp_dequeue_style( ‘wp-block-library’ ); wp_dequeue_style( ‘wp-block-library-theme’ ); // Remove WooCommerce block CSS wp_dequeue_style( ‘wc-blocks-style’ ); wp_dequeue_style( ‘global-styles’ ); /** * @psalm-suppress UndefinedFunction */ remove_action( ‘wp_body_open’, ‘wp_global_styles_render_svg_filters’ ); } );Continue reading
// [d] – inserts the current day with two digits e.g. 06 // [D] – inserts the current day with three letters e.g. Mon // [j] – inserts the current day without leading zeros e.g. 6 // [l] – inserts…Continue reading
/*———————————————– Distinto color segun estado de entrada ———————————————–*/ function posts_status_color() { ?>Continue reading
add_filter( ‘charitable_campaign_suggested_donations’, ‘example_charitable_campaign_suggested_donations’, 10, 2 ); function example_charitable_campaign_suggested_donations( $value = array(), $campaign_object ) { if ( empty( $value ) ) { return; } /* $value is an array of suggested donations. It often looks like this by default: Array (…Continue reading
add_action( ‘admin_bar_menu’, function ( $admin_bar ) { // Only show this when editing a post. $screen = get_current_screen(); if ( ! $screen || ‘post’ !== $screen->base ) { return; } $post = get_post(); $post_type_object = get_post_type_object( $post->post_type ); if (…Continue reading
/** * Setting Hero Block on Pages by default. * */ function awesome_register_page_template() { $post_type_object = get_post_type_object( ‘page’ ); $post_type_object->template = array( array( ‘core/pattern’, array( ‘slug’ => ‘frost/hero’, ) ), ); } add_action( ‘init’, ‘awesome_register_page_template’ );Continue reading