WP-Mix

A fresh mix of code snippets and tutorials

Category Archive: WordPress

Posts about WordPress

Page 1 of 16

WordPress Sidebar Template Code

When developing my free WordPress starter theme, I end up with lots of sweet code snippets that for whatever reason didn’t make the final cut. For example, the sidebar template was recently refactored with shiny new code. So what to do with the previous sidebar code? Delete it? Nah, instead I would rather share it [… ]

Disable Combined Scripts in the WordPress Admin Area

If you’ve ever tried to debug JavaScript or CSS for pages in the WordPress Admin Area, you know that it’s next to impossible to sort out which files contain which scripts. Why? Because WordPress combines them all at runtime into a single, concatenated script. It’s referred to as concatenation, and it helps to reduce the [… ]

WordPress Post Navigation Enlightenment

For some reason, I am fascinated by how post navigation is handled by WordPress and others CMSs. For example, what is the correct order of the “previous” and “next” post-navigation links? Is it different for single posts versus archive views? Should the arrow point right or left? And so forth. After pondering these questions periodically [… ]

WordPress Trigger and Target Interim Login Screen

Our previous post on WordPress login parameters is very complete. Or so I thought. But I had forgotten about the “Interim Login Screen”. The interim login screen is displayed when you are working in the WP Admin Area and for some reason the session expires and you are logged out.

WordPress Disable jQuery Migrate

The jQuery Migrate plugin is used to help sites upgrade to the latest version of jQuery. The script restores APIs that have been removed, and the development version shows warnings in the browser console for any deprecated or missing APIs. This enables developers and admins to more easily upgrade from older to newer versions of [… ]

WordPress Remove Menu Item

Quick WordPress tutorial for you today. How to remove an unwanted item from the WordPress menu. You know, the main menu that you find on the left-hand side of the screen when logged into the WordPress Admin Area. If you have a menu item that you want to remove, this post shows an easy way [… ]

WordPress Trigger 404.php Template

Recently I needed a programmatic way to trigger a 404 error in one of my free WordPress plugins. Fortunately WordPress makes it very easy to do. This quick tutorial explains two different ways to make it happen.

WordPress pre_ get_ posts example

Here is a quick example showing how to modify the main WP Query (Loop) using the pre_ get_ posts filter hook.

Secure WordPress Login Page

If you try to log in to some of my WordPress-powered sites via the WP Login Page, you will be met with a 403 “Forbidden” response. For sites where I am the only registered user, I lock things down to prevent endless waves of drip force attacks. It really helps to reduce server load, conserve [… ]

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.

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

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