Welcome to our WordPress Code Snippets collection. Here you'll find practical, copy-paste ready code solutions for common WordPress customization needs.
WooCommerce Code Snippets
How to Disable Add to Cart in WooCommerce and Redirect to Product Page
Learn how to disable the Add to Cart button and redirect users directly to the product page for catalog-style WooCommerce stores.
Social Media Integration
Display Instagram Feed with Images and Videos Using API
Embed your Instagram feed directly on your WordPress site using the Instagram API, showing both images and videos.
Forms & Email
Send Plain Text Emails in Forminator
Fix email formatting issues in Forminator plugin by sending plain text emails and removing unwanted commas from names.
WordPress Security Snippets
Fix Username Enumeration Vulnerability
Protect your WordPress site from username enumeration attacks through the REST API endpoint.
4 Ways to Remove WordPress Version Number
Hide your WordPress version number from source code and feeds to improve security.
Database & Admin Snippets
Disable Code Snippet from Database
Learn how to disable a problematic code snippet directly from the WordPress database when you can't access the admin.
SEO Code Snippets
Block Unwanted Query String URLs
Prevent duplicate content issues by blocking unwanted query string URLs identified in Google Search Console.
Hide Pagination Pages from Search (Yoast SEO)
Optimize your site's search visibility by properly handling paginated archive pages with Yoast SEO.
Media & Uploads
Enable SVG Files Upload in WordPress
Allow SVG file uploads in WordPress media library with proper security measures.
Quick Code Reference
Disable WordPress Updates
// Add to functions.php
add_filter('auto_update_plugin', '__return_false');
add_filter('auto_update_theme', '__return_false');
Remove WordPress Version
// Add to functions.php
remove_action('wp_head', 'wp_generator');
Disable XML-RPC
// Add to functions.php
add_filter('xmlrpc_enabled', '__return_false');
Increase Memory Limit
// Add to wp-config.php
define('WP_MEMORY_LIMIT', '256M');
Enable Debug Mode
// Add to wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
More WordPress Resources: