No Index Category

// No Index Category / Kiri Vadivelu / 2026 add_filter(‘wp_robots’, ‘no_index_category’); function no_index_category(array $robots) { // Check if the current post has ‘members’ category if (is_single() && has_category(‘members’)) { $robots[‘noindex’] = true; } return $robots; }Continue reading

No Index Page

// No Index Page / Kiri Vadivelu / 2026 add_filter( ‘wp_robots’, ‘no_index_page’ ); function no_index_page( $robots ) { if ( is_page() ) { $robots[‘noindex’] = true; } return $robots; }Continue reading

Open external links in new tab

document.addEventListener(“DOMContentLoaded”, function() { var links = document.querySelectorAll(“a[href]”); links.forEach(function(link) { if (link.hostname !== window.location.hostname) { link.setAttribute(“target”, “_blank”); link.setAttribute(“rel”, “noopener noreferrer”); } }); });Continue reading

Short Breadcrumb Title

.wp-block-breadcrumbs ol li:last-child { max-width: 175px; /* Set desired limit */ white-space: nowrap; /* Prevents line breaks */ overflow: hidden; /* Hides text exceeding width */ text-overflow: ellipsis; /* Adds the “…” dots */ display: inline-block; }Continue reading

Auto Admin Logout

// Auto Admin Logout / Kiri Vadivelu / 2026 add_filter( ‘auth_cookie_expiration’, ‘short_session_admin’, 10, 3 ); function short_session_admin( $expiration, $user_id, $remember ) { // Only apply the short timeout for administrators if ( user_can( $user_id, ‘manage_options’ ) ) { return 3600;…Continue reading

Sticky Tag Post

// Sticky Tag Post / Kiri Vadivelu / 2026 add_action(‘pre_get_posts’, function($query) { if (!is_admin() && $query->is_main_query() && is_tag()) { $sticky_posts = get_option(‘sticky_posts’); if (!empty($sticky_posts)) { add_filter(‘posts_orderby’, function($orderby, $query) use ($sticky_posts) { if (!is_admin() && $query->is_main_query() && is_tag()) { global $wpdb;…Continue reading