WP-Mix

A fresh mix of code snippets and tutorials

Share links without sending referrer information

Here is a quick tip for sending links without including any referrer information. I found this service used at WordPress.com.

Specify images for web pages

This is a general technique for specifying an official image for your site, without actually displaying it on the front-end. Useful for catch-all social-media purposes.

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.

WordPress Create New User

Two ways to programmatically create new users in WordPress. The first method uses wp_create_user() and the second method uses wp_insert_user().

PHP Sanitize Form Data

On the Web, Cross-Site Scripting (XSS) is one of the most common types of attacks. Fortunately, there is an easy fix: always filter input data and always escape output data.

.htaccess template for custom directory views

Here is an .htaccess template for displaying a customized directory with file view enabled, such that all files except for those indicated are displayed as a list.

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.

Protect files with .htaccess

Here are some examples of how to use .htaccess to protect any sensitive files on the server.

Display a Simple “Tweet This” Link

Twitter changes their API quite a bit, however it is still possible to display a simple “tweet this” link anywhere on your web pages.

Limit HTTP Request Size

This .htaccess snippet can be used to restrict the total size of the HTTP request body sent from the client.

WordPress Create Shortcode

Ultra-quick guide to help you create a WordPress Shortcode. Aimed at experienced WordPress users who need a basic example of how to create shortcodes.

WordPress Check PHP Version

When working with the WP API, you may need to check the current version of PHP to ensure compatibility.