Popular Posts
All posts ordered by popularity
Combine all CSS files with PHP
Here is a simple PHP script that will combine all CSS files (stylesheets) in a given directory. Delivering one CSS file with your web pages is much faster than delivering multiple files because there are fewer HTTP requests involved.
Display all comments on separate page
Normally WordPress themes display comments on the same post or page. WordPress makes it possible to page the comments, so that there are only so many per page, but by default it’s not possible to display all comments on a separate page. Here’s how to do it in three easy steps.
503 Service Unavailable Headers via PHP
Sending a few HTTP headers is a simple way to let visitors and search engines know that your site currently is unavailable. This is useful when you are doing maintenance and don’t need access to the front-end of your site. Simply add the rules when your site is down, and then remove them once everything […]
Allowed HTML tags for wp_kses()
Developing WordPress plugins, I frequently need to specify an array of allowed HTML tags and attributes for wp_kses(). The collection of allowed tags has grown over time, and so I’m posting it here at WP-Mix for future reference. Just makes my life easier, hopefully it helps you too.
CSS box-sizing all elements
The CSS box-sizing property makes it much easier to work with elements that have padding and borders. Here is a ruleset that will apply the box-size property to all elements.
PHP Search Multidimensional Array
When you need to search an array using PHP, you can call upon the ancient powers of in_array() and call it a day. But that only works for flat, or one-dimensional arrays. What if you need to find a value in a multi-dimensional array? Well my friend, there isn’t a native PHP function to help […]
Get All User Email Addresses in WordPress
Putting together a mailing list? Here is an easy way to get all user email addresses from your WordPress database.
Get Current Post Type in the WordPress Admin Area
In WordPress, you can create posts, pages, or any custom post type. Within your theme template, you can get the current post type using the core WP function, get_post_type(). But that doesn’t work in the Admin Area. For example, my Disable Gutenberg plugin provides conditional functionality to the “Add New” and “Edit” screens based on […]
WordPress clean up do_pings
When your WordPress site is configured to enable pings, the database can fill up with many do_pings WP Cron entries. This post provides a couple of quick ways to clean them up, by either disabling the functionality or deleting the do_pings entries from the database.
WordPress repair and optimize InnoDB
This tutorial explains how to use WordPress’ built-in tools for optimizing database tables that are of the InnoDB type. Also works for good ’ol MyISAM database tables.
Display Images with User Submitted Posts
Here is a quick recipe for displaying linked images for images submitted with the User Submitted Posts plugin.
WP Admin link to All Options
The WordPress database houses more settings than those available in the Admin Area. Here’s a quick code snippet to display an “All Options” screen to view otherwise hidden data.