WordPress snippets that just work.
30 tested snippets for security, speed, the admin area and WooCommerce, including a pack for Greek e-shops. Each one explained, each one checked on the latest WordPress before it went in.
- Disable XML-RPC Turn off XML-RPC and pingbacks in WordPress, and stop advertising the xmlrpc.php endpoint, with a few lines of PHP.
- Hide the WordPress version number Remove the WordPress version from the generator tag, RSS feeds and ?ver= on scripts and styles, while keeping cache busting.
- Block user enumeration via ?author= Stop bots finding your WordPress usernames through ?author=1 redirects and the users sitemap.
- Disable the REST API users endpoints for visitors Hide /wp-json/wp/v2/users from logged-out visitors so your WordPress usernames aren't public. The block editor keeps working.
- Disable the theme and plugin file editor Remove the Theme File Editor and Plugin File Editor from WordPress for every user, so nobody can edit PHP files from the dashboard.
- Change the admin footer text Replace "Thank you for creating with WordPress" at the bottom of every admin page with your own text and links.
- Hide the admin bar for non-admins Hide the WordPress toolbar on the front end for subscribers, customers and every other role except administrators.
- Remove default dashboard widgets Clean up the WordPress Dashboard by removing Events and News, Quick Draft, Activity, At a Glance, Site Health and the Welcome panel.
- Add a "Duplicate" link to posts and pages Add a secure Duplicate link to the Posts and Pages lists that copies content, terms, custom fields and featured image into a new draft.
- Only get auto-update emails when something fails Stop WordPress emailing you after every successful automatic update of core, plugins or themes. Failure emails still arrive.
- Disable emojis Remove the WordPress emoji script and styles from the front end, admin, feeds and emails to save a request on every page.
- Remove jQuery Migrate on the front end Stop WordPress loading jQuery Migrate on the front end of your site. jQuery itself still loads, and the admin area is unchanged.
- Disable WordPress post embeds Stop other sites embedding your posts, remove oEmbed discovery links and wp-embed.js, and redirect /embed/ URLs. YouTube embeds still work.
- Limit post revisions Keep at most 5 revisions per post or page in WordPress, so your database doesn't fill up with old copies.
- Change the excerpt length Change the length of automatic WordPress excerpts from 55 words to any number you like, with one small filter.
- Add featured images to your RSS feed Show each post's featured image at the top of its RSS feed item, so feed readers and email newsletters include a picture.
- Open external links in a new tab Make links to other websites open in a new tab with rel="noopener", using a few lines of JavaScript and no plugin.
- Hide the reCAPTCHA badge Hide the floating Google reCAPTCHA v3 badge with CSS, and add the notice Google requires when the badge is hidden.
- Disable big image scaling Stop WordPress shrinking large uploads to 2560 pixels and renaming them with -scaled, so the original file stays as the full size.
- Disable attachment pages Turn off WordPress attachment pages so their URLs redirect to the media file, on sites created before WordPress 6.4.
- Add Google Analytics 4 to WordPress Add the Google Analytics 4 (gtag.js) tag to the head of every page on your WordPress site without an analytics plugin.
- Use your own logo and link on the login page Make the WordPress login logo link to your homepage, show your site name as its title and use your site icon as the logo.
- Show a generic login error message Replace WordPress login errors that reveal whether a username exists with one message for any wrong username, email or password.
- Change the "Add to cart" button text Change the WooCommerce "Add to cart" button text on product pages and shop listings, without touching other button types.
- Hide other shipping rates when free shipping is available When a WooCommerce order qualifies for free shipping, hide the paid shipping rates and keep only free shipping and local pickup.
- Remove the "Additional information" tab Remove the "Additional information" tab (weight, dimensions, attributes) from WooCommerce product pages.
- Set a minimum order amount Require a minimum cart total before customers can check out in WooCommerce, with a clear message. Works with block and classic checkout.
- Receipt or invoice choice with ΑΦΜ and ΔΟΥ for Greek shops Let WooCommerce customers choose Απόδειξη or Τιμολόγιο and, for invoices, enter a validated ΑΦΜ, ΔΟΥ, company name and business activity.
- Validate a Greek VAT number (ΑΦΜ) A PHP helper that checks a Greek VAT number (ΑΦΜ) with the official check-digit algorithm, ready to use in forms and WooCommerce.
- Validate Greek phone numbers at checkout Check that Greek billing phone numbers in WooCommerce have 10 digits and start with 2 or 69. Works with block and classic checkout.
No snippet matches that yet. Tell us what you need and we'll consider adding it. Suggest a snippet
Move your snippets over this afternoon.
Importing changes nothing until you switch over, and your old shortcodes keep working.