Archives: Snippets
Convert headings to sentence case
function convert_to_sentence_case($text) { $exceptions = array( ‘API’, ‘URL’, ‘HTML’, ‘CSS’, ‘PHP’, ‘SQL’, ‘XML’, ‘JSON’, ‘HTTP’, ‘HTTPS’, ‘CEO’, ‘CTO’, ‘CFO’, ‘USA’, ‘UK’, ‘EU’, ‘AI’, ‘ML’, ‘IoT’, ‘GPS’, ‘FAQ’, ‘PDF’, ‘SEO’, ‘ROI’, ‘KPI’, ‘B2B’, ‘B2C’, ‘SaaS’, ‘WordPress’, ‘WooCommerce’, ‘jQuery’, ‘JavaScript’, ‘MySQL’, ‘AWS’…Continue reading
Untitled Snippet
const crypto = require(‘crypto’); const secret = ‘•••••••••’; // Your verification secret key const userId = current_user.id // A string UUID to identify your user const hash = crypto.createHmac(‘sha256’, secret).update(userId).digest(‘hex’);Continue reading
PRINT WP POST
add_filter(‘the_content’, function($content) { if (!is_single()) return $content; $button = ‘ Print Post ‘; $pos = strpos($content, ‘ ‘); if ($pos !== false) { return substr_replace($content, $button, $pos + 4, 0); } return $button . $content; });Continue reading
Admin Privileges Being Returned
add_action(‘init’, function () { if (current_user_can(‘administrator’)) { $role = get_role(‘administrator’); if ($role) { // Capabilities related to editing pages, posts, and more $capabilities = [ ‘edit_posts’, ‘edit_others_posts’, ‘edit_published_posts’, ‘edit_pages’, ‘edit_others_pages’, ‘edit_published_pages’, ‘publish_posts’, ‘publish_pages’, ‘delete_posts’, ‘delete_others_posts’, ‘delete_published_posts’, ‘delete_pages’, ‘delete_others_pages’, ‘delete_published_pages’, ‘read’,…Continue reading
Account Order form
Safe, Universal Performance Optimization Middleware for NexSouk.com
Safe Performance Middleware for NexSouk.com
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
Optimized & Safe NexSouk Performance Booster Snippet (with toggles off for embeds + block CSS)
// =============================== // ✅ NexSouk Performance Booster (Safe Version) // PHP performance enhancements for: // – Load speed // – Core Web Vitals // – Accessibility // =============================== add_action(‘init’, function() { // ✅ Disable Emoji Scripts (safe) remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7);…Continue reading