WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 4 of 36

Break Out of Frames for WordPress

Quick JavaScript snippet to prevent scrapers and turds from framing, defaming, and/or stealing your precious content..

Remove www and index.php from URL

Here’s a handy .htaccess snippet for canonicalizing URLs by removing the “www”, “index.php”, and “index.html” from all requests.

WordPress Create Upload Files and Directories

This tutorial explains how to create new files and directories in the WordPress /uploads/ folder.

PHP Detect All Versions of IE

Quick code snippet for detecting all versions of good ’ol IE (Internet Explorer).

Detect Chrome, IE, Firefox, Opera, and Safari

How to detect each of the major browsers (Chrome, IE, Firefox, Opera, Safari) client-side via JavaScript.

.htaccess Force GET or POST Requests

Here is how to force all HTTP requests to be either GET or POST. Easy to modify technique can be used for other types of requests as well.

Additional file-types for mod_expires

Here is a list of the most common file-types for Apache’s mod_expires, which is used for configuring expires headers for better cache control.

Get child or parent theme URI & path

These days, WordPress provides numerous ways to get the path and URI for the current theme directory. This post is reference for WP developers who need to get the URI and/or path for the current child or parent theme. Just grab, gulp, and go..

Date and Time with PHP and WordPress

This post explains the difference between displaying the date and time with PHP vs. displaying the date and time with WordPress.

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.

WordPress Disable REST API Header Links

WordPress 4.4 adds all sorts of new REST API functionality. Which is great if your site is using it. But if not, then you may want to remove all of the extra baggage that WordPress now adds to every page load. This tutorial explains how to disable it.

PHP Add and Remove Query String Variables

Two quick functions, one for adding a query string variable and another to remove a query string variable. Either of these functions can be used in any PHP script to modify query-string parameters.