Code snippets to restrict authors and contributors of multi-author WordPress websites. The first piece of code prevents them from seeing content assigned to other users. The second ensures that users can only see post counts of their own content.
By default, WordPress doesn’t come with suspicious login notifications and two factor authentication. We use plugins (or custom code) for these things. This piece of code notifies you when a user logs in to your site. Good for websites with few users.
When an image is uploaded to WordPress, its title is auto-populated based on filename. But WordPress does NOT set the image Alt Text or other fields. For image-heavy sites, this implies repetitive manual effort. Read to learn how to automate this.
By default, WooCommerce will only show star ratings for products with ratings greater than zero. That means star ratings are not displayed until a product has at least one review. If you’d rather always have them displayed, use the code in this post.
If you use the a3 Lazy Load plugin on a WooCommerce shop, you may notice that while images on single product pages are nicely lazy loaded, the lazy-loading feature just doesn’t work on archive pages. This article contains code to fix the problem.
WordPress posts by default have an excerpt meta box where you can manually type in a custom excerpt. Pages don’t have this feature out-of-the-box. If you would like to enable excerpts on your WordPress pages, use the code in this post.