WP-Mix

A fresh mix of code snippets and tutorials

Fix Database Won’t Start Error for MAMP Pro

I use MAMP Pro for some of my local pet projects and development. Normally it works great, but the other day I couldn’t get MySQL started. It kept crashing during startup. This post explains the related errors and how I managed to resolve the issue and get MAMP working again.

Find Password Protected Posts in the WordPress Database

Recently I needed to view all posts that were password-protected. Not finding a WordPress function for this, I wrote a quick SQL command to find all password-protected posts in the WordPress database.

Apache Require HTTP 1.1 for POST Requests

A reader recently asked how to limit POST requests to only HTTP 1.1. Well here is an .htaccess snippet that will do it.

Change Database Type to InnoDB or MyISAM

Originally, the WordPress database was formatted as type MyISAM. Then years later they changed the database format to InnoDB. Reportedly, InnoDB is superior to MyISAM in several ways. This is true for any dynamic site, not just WordPress. If your database is not InnoDB, you may benefit from changing it. This quick tutorial explains how […]

Remove All Matching Options from the WordPress Database

Typically when you want to remove an option from the WordPress database, you can use a function like delete_option(). But there are cases where such functions are insufficient. For example, in a previous version of my plugin Blackhole for Bad Bots, a database option is added for each blocked request, and each option name includes […]

Force Trailing Slash with .htaccess

This quick code snippet enables you to enforce that all directory URLs append a trailing slash. It is a very simple code snippet, only a few lines and done. Here are a few examples to give you a better idea of how it works.

Disable manual resizing with meta viewport

Just a quick snippet for telling the browser to disable manual resizing of the page. You can see this technique in use here at WP-Mix as well as most of my other websites. If you view the source code of any web page on the site, you can see the meta viewport tag in effect […]

Google Search Engine Alternatives

Google is the Web’s #1 search engine, hands down. But not everyone is in love with it. Fortunately, there are plenty of decent alternatives for those who wish to diversify their search results. Here is a list of the top alternatives to the Google search engine.

WordPress: Add “View HTML” Button on Edit Post Screen

On a recent project, I found myself viewing the HTML source for every post and page on a WordPress-powered site. After about a thousand clicks, I decided to write a code snippet that adds a “View HTML” button (it’s actually just a link) for each post row displayed on the WordPress “Edit Post” screen. So […]

Video Tutorials: Running WordPress on Shared Hosting

After months of hard work, I am pleased to announce the launch of my new video course on running WordPress on shared hosting. This course shows you how to get your own WordPress-powered site up and running as quickly and inexpensively as possible. It walks through the entire process step-by-step, with helpful visuals and examples […]

Redirect Attacker to Special Message

If you are using Apache server, you can stop an attack by getting the IP address of the attacker and then using it to block or redirect all of their requests. Normally I just block the requests using either Deny or Require directives (depending on Apache version), but sometimes it’s fun to redirect the attacker […]

PHP: Remove Empty File Data

This quick function does one simple thing. It removes empty file data from a PHP files array. As you may know, the structure of the $_FILES array is sort of backwards from what normally would be expected. Because of this, removing empty file data from the array requires some extra wrangling. So to make things […]