Category: Admin
Disable Pattern Directory
add_action( ‘after_setup_theme’, function() { remove_theme_support( ‘core-block-patterns’ ); });Continue reading
Tasty Roundups – Change Heading from h2 to h3
add_filter( ‘render_block_tasty-roundups/item’, function ( $block ) { $initial_block = $block; $block = preg_replace( ‘~Continue reading
Facebook Domain Verification snippet
Product tabs (copy)
/** * Add a custom product data tab */ add_filter( ‘woocommerce_product_tabs’, ‘woo_new_product_tab’ ); function woo_new_product_tab( $tabs ) { // Adds the new tab $tabs[‘test_tab’] = array( ‘title’ => __( ‘Shipping Info’, ‘woocommerce’ ), ‘priority’ => 50, ‘callback’ => ‘woo_new_product_tab_content’ );…Continue reading
WordPress Typography Enhancement: Preventing Widows in Conten
/** * Avoid Typography Widows */ function kl_avoid_content_widows( $content ) { $pattern = ‘@(?:\s)([[:punct:][:word:]]+)(?:\s)(?!/>)([[:punct:][:word:]]+)(?:\s)([[:punct:][:word:]]+)@m’; $replacement = ‘ $1 $2 $3‘; $content = preg_replace( $pattern, $replacement, $content, -1 ); return $content; } add_filter( ‘the_content’, ‘kl_avoid_content_widows’ );Continue reading
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
Enable HTTP Strict Transport Security (HSTS) in WordPress
/** * 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
Limit Heartbeat
add_filter( ‘heartbeat_settings’, function ( $settings ) { $settings[‘interval’] = 120; return $settings; } );Continue reading
Cores especificas para cada status do posts/pages
/*———————————————– Distinto color segun estado de entrada ———————————————–*/ function posts_status_color() { ?>Continue reading