PCBoost: Menu landing-page links (v1.0)

/** * PCBoost | Menu landing-page links (v1.0, 22 Nov 2026) * * Adds a “Popular pages” block with links to the landing pages inside the desktop mega-menu * ([pcb_desktop_nav]) and the mobile drawer ([pcb_mobile_drawer]) from snippet 186451 * “Pcboost…Continue reading

PCBoost — My account

/** * PCBoost — My account (look and wording of the customer’s account pages) * WPCode snippet: PHP, Run Everywhere. * * For every logged-in customer, business or not, on the My account pages only: * – navigation as a…Continue reading

Pcb county fix wpcode

/** * PCBoost – Checkout: County fix v1.0.0 – 2026-12-01 * * WooCommerce 11.3.1, block checkout. The County field is optional in the UK, but the checkout keeps a hidden error * on it (“Please enter a valid state/county”) while…Continue reading

Email me when the list of administrators changes

// Email me when the list of administrators changes. (edited) // Run the check once a day. add_action( ‘init’, function () { if ( ! wp_next_scheduled( ‘hawp_check_admins’ ) ) { wp_schedule_event( time() + 300, ‘daily’, ‘hawp_check_admins’ ); } } );…Continue reading

Hide Drafted Pages in menus

add_filter(‘wp_get_nav_menu_items’, function ($items) { // Frontend only if (is_admin()) { return $items; } foreach ($items as $key => $item) { if ($item->object !== ‘page’) { continue; } if (get_post_status($item->object_id) !== ‘publish’) { unset($items[$key]); } } return $items; }, 10);Continue reading

Disable Random Content Redirects

// Turn off the random content redirects added in WordPress 7.2 (/random/, /random/category/news/, ?random). add_filter( ‘wp_enable_random_content_redirect’, ‘__return_false’ ); // The /random/ URLs are stored rewrite rules, so rebuild them once if any are still there. add_action( ‘init’, function () {…Continue reading

Sticky Posts on Category Pages (copy)

add_action(‘pre_get_posts’, function($query) { if (!is_admin() && $query->is_main_query() && is_category()) { $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_category()) { global $wpdb; $sticky_list = implode(‘,’, array_map(‘intval’, $sticky_posts)); return “FIELD({$wpdb->posts}.ID, {$sticky_list}) DESC,…Continue reading