WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 33 of 35

WordPress plugin redirect when settings saved

This technique is a bit esoteric and mostly for my own reference. Feel free to try the code if it makes sense to you; otherwise, maybe just move on to the next code snippet. Just not enough time in the day to explain everything.

Vanilla JavaScript: Focus Input on Page Load

Super quick tutorial today. How to focus the user on any input when the page loads. For example, when you visit the WordPress Login Page, the “Username” field is focused automatically. This technique is very simple and works on any input or element that supports a focused state.

Filter pre tags in bbPress

A couple of functions used at htaccessbook.com to enable unescaped/unencoded pre and code tags in bbPress forum posts.

WordPress Change Excerpt Length

This code snippet is SO easy.. check it out if you want to change the default number of words included by default in WordPress excerpts.

Disable WordPress Automatic Updates

In case you haven’t noticed, WordPress auto-updates its core files by default. Neat but not always desired. Here is how to disable auto-updates with a few lines of code.

Nice little input button with CSS

Just making a note of the CSS used to make a nice little input button, leftover snippet from a previous project.

WordPress Disable Self Pings

Depending on your WordPress configuration, plugins, and so forth, your site may be suffering from “self-pings”. Self-pings are pingbacks from your own domain, which are not necessary and look kind of silly displayed alongside other, actual pingbacks. If your site is haunted by self-pings, here is a quick code snippet to stop them.

WordPress Display Plugin “View Details” Screen

Everyone is familiar with the WordPress Plugins screen. Where you can view all installed/active plugins, etc. On that screen, there is a link next to each plugin that says “View Details”. When you click it, a popup dialog overlays the page content. Inside of that dialog is a tabbed interface where you can learn about […]

Truncate Database Table

Quick SQL code snippet that enables you to truncate any MySQL database table.

PHP: Get $_SERVER Variables

I use a variation of this function to get super global $_SERVER variables in my free shapeSpace WordPress theme. The function returns all relevant variables contained in the $_SERVER array. Note this is a general PHP technique, so WordPress is not required for this one.

Free Up Server Disk Space

Recently I spent some time clearing up more free space on my server. Here are some notes on things to check when doing so.

PHP Error Log Tricks

Super useful trick for customizing error logs when working with PHP.