The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join

Functions

Automatically Copy Featured Image Alt Text to Image Caption

Keeping image captions and alt text consistent can save time when managing media. This snippet automatically copies the image’s Alt Text to its Caption if the caption is empty when the attachment is saved. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Edit or […]


Display a “New” Badge on Recently Published Posts

Highlight newly published content by automatically displaying a “New” badge next to post titles for a specified number of days. This helps attract attention to fresh content and improves user engagement. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Newly published posts (within the […]


Automatically Add Estimated Reading Progress Bar

Enhance the reading experience by displaying a progress bar at the top of your website that fills as visitors scroll through a post. This feature is commonly found on news, blog, and documentation websites. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Open any […]


Automatically Add a Reading Time Estimate to Posts

Show an estimated reading time at the beginning of every blog post based on the content length. This gives readers a quick idea of how long the article will take to read and can improve engagement. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. […]


Automatically Expire Posts on a Scheduled Date

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. It’s useful for job listings, promotions, announcements, events, and time-sensitive content. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Add […]


Automatically Prevent Duplicate Post Titles

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 useful for news sites, documentation websites, product catalogs, and large blogs where duplicate titles can cause confusion. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the […]


Automatically Rename Uploaded Files to SEO-Friendly Names

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 reduce server processing time and save storage space. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Upload a new PDF […]


Automatically Add alt Text to Images from Their Attachment Title

Description Images without alt text can negatively impact accessibility and SEO. This snippet automatically uses the image attachment title as the alt attribute whenever an uploaded image doesn’t already have one. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Newly displayed images without an […]


Sticky Header

Keep the website header visible while scrolling. This improves navigation and user experience, especially on long pages. Usage Apply the .site-header class to your header element. <header class=”site-header”> <!– Header Content –> </header>


Automatically Add rel=”noopener noreferrer” to External Links

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 the linked page from accessing your website through the window.opener object. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. External […]


Proudly supported by