POST PURGE

add_action(‘init’, function () { if (!current_user_can(‘delete_posts’)) return; // Run only if you explicitly visit this URL: if (!isset($_GET[‘delete_all_posts’])) return; $post_types = [‘post’]; // You can change this to [‘post’, ‘product’, ‘your_cpt’] foreach ($post_types as $type) { $posts = get_posts([ ‘post_type’…Continue reading

CHAPTER CREATION – Form Logic & AJAX Handlers – Snippet 2/2

// ===================================================== // PAT CHAPTER CREATION SYSTEM – SNIPPET 2: FORM LOGIC & AJAX HANDLERS (FIXED) // Fixed AJAX calls to use working handlers and proper element targeting // Add to Code Snippets – Run everywhere // ===================================================== // Prevent…Continue reading

NexSouk Performance & Accessibility Optimizer

// =============================== // ✅ NexSouk.com Performance & Accessibility Optimizer // =============================== add_action(‘init’, function() { // ✅ Remove emoji scripts remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7); remove_action(‘wp_print_styles’, ‘print_emoji_styles’); // ✅ Reduce Heartbeat API frequency (to lower backend resource usage) add_filter(‘heartbeat_settings’, function($settings) { $settings[‘interval’] =…Continue reading

LearnDash Course Search Widget

/** * Author: Sumaiya, Anytype Documentation: https://object.any.coop/bafyreifrops5tp5h7anwsa7k7k4rphi5nvz62sgnxhdidfogjcspk3afli?spaceId=bafyreih4bocrmskuomcrks3sjwpnzxpbxvxwgto23vof3umg2fywdqzjmy.31bq39w6q8ru7&inviteId=bafybeifc55atash7zlqcjd3fv425bkwl7z5zstcxdilct5hstlng73xwci#6kKA3QiwnksqLbpcJ4T6UhmQ5BHzgJUfbpn1QLnkv5Lv * * LearnDash Course Search Widget – Popup Modal Version * * This snippet creates a WordPress shortcode to display a dynamic search widget for LearnDash courses. * Shortcode: [learndash_search_widget] * * Features:…Continue reading

Accessibility Improvement

// 1. Ensure ARIA attributes match proper roles function nexsouk_fix_aria_roles($content) { // Simplistic approach: strip aria-* from elements without proper roles // Better: adjust based on your theme/structure with context $valid_roles = array( ‘button’ => [‘aria-pressed’, ‘aria-expanded’], ‘navigation’ => [‘aria-label’,…Continue reading

VVWC Global Helpers

/** * VVWC Helper Functions */ // Elementor safety post injection (used during cron) function vvwc_inject_dummy_post_context() { if ( defined( ‘DOING_CRON’ ) && DOING_CRON ) { global $post; if ( ! isset( $post ) || ! $post instanceof WP_Post )…Continue reading