WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 8 of 35

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.

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.

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.

Force file download with .htaccess

Here is a quick .htaccess snippet that will force files to download instead of displaying in the browser. This method works for any site running on an Apache server.

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 […]

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.

WordPress redirect logged in users

Nice WordPress snippet to redirect logged in users to any location. Also optionally redirect visitors who are not logged in to WordPress.

Auto-Focus Form Fields with jQuery

When you load a page that contains a form, it may be useful to automatically place the user’s cursor in the first form field. This post explains how to do autofocus with jQuery.

WordPress enqueue user-agent stylesheets

WordPress makes it clean and easy to enqueue custom stylesheets via the functions.php file. Here’s how to do it for user-agent stylesheets.

Shortcut to WP Login

Back in January of 2011, Chris Coyier posted a sweet .htaccess technique for setting up Simpler Login URLs in WordPress. This is a follow-up technique that’s slightly improved..

PHP: Get current URL

Nice lil slab of PHP to get the current URL. Useful for a wide variety of applications, nice one to have in the tool belt.

Cross domain posting with Ajax

Technically cross-domain posting is not allowed, but here is a workaround that may prove useful for your brainstorming sessions. Note that this technique is aimed at advanced developers.