/** * PCBoost | Auto product grid [pcb_grid] + filter tabs [pcb_tabs] (v2.0, 22 Nov 2026) * * [pcb_grid] shows the best-selling IN-STOCK, catalogue-visible products of a category (optionally one brand), * 10 by default, then a “See all” button…Continue reading
/** * 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 – OpenAI Ads pixel: hashed user data (v1.0) * * Adds hashed customer data to the OpenAI Ads pixel so ChatGPT Ads can match * purchases to ad clicks (“Improve event quality” warning in Ads Manager). *…Continue reading
/** * PCBoost – Public stock display v1.1.0 – 2026-12-01 * * What customers see instead of the exact stock quantity: * – more than PCB_STOCK_CAP units -> “30+” (30+ units available / 30+ in stock / In stock (30+))…Continue reading
/** * 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
/** * 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. (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
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
// 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
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