This snippet allows you to automatically change a published post to Draft after a specified expiration date stored in a custom field named post_expiry_date.…
Description This snippet prevents users from publishing or updating a post with a title that already exists for the same post type. It’s especially…
Description When you upload a PDF, WordPress automatically generates a preview image (thumbnail). If your website doesn’t use PDF previews, disabling this feature can…
Description Images without alt text can negatively impact accessibility and SEO. This snippet automatically uses the image attachment title as the alt attribute whenever…
Sticky Header
2 approachesKeep the website header visible while scrolling. This improves navigation and user experience, especially on long pages. Usage Apply the .site-header class to your…
Description The WordPress Admin Bar is displayed for logged-in users on the frontend by default. This snippet hides the Admin Bar for all users…
This snippet automatically adds rel="noopener noreferrer" to external links in post content that open in a new tab (target="_blank"). It improves security by preventing…
By default, WordPress compresses JPEG images during upload to reduce file size. This snippet disables that compression by setting the image quality to 100%,…
Steps Open functions.php. Add the code below. Save the file. Done — a custom notice will be displayed at the top of the WooCommerce…
Description WordPress creates a separate attachment page for every uploaded media file. These pages often provide little value and can lead to thin content.…
Create a file upload input that displays a preview of the selected image before upload. Usage Ideal for: User profile images Product image uploads…
Steps Open functions.php. Add the code below. Save the file. Done — the specified coupon code will be automatically applied when a customer visits…