JavaScript console.log Tricks (From a Lazy Developer)

Developers often underestimate the time it takes to debug something. Consequently, we are too lazy (and proud) to get a proper debugging environment going because, well, it’s a simple problem & will only take “a few minutes” to fix. This is where console.log() comes into play. It might be dirty debugging, but it works. Years of experience have thought me a few tricks with console that save serious amounts of time & nerves.

Read more

PHP Namespaces in WordPress – a No Nonsense Guide

PHP namespaces are almost ten years old (yes, you’re getting old). Despite a decade passing by since PHP v5.3 was released many developers still don’t have a basic understanding of namespaces. Truth be told WordPress doesn’t use namespaces so “you don’t need to know how to use namespaces.” You don’t need to be a namespace ninja but getting a grasp on the basics is simple and will do you good.

Read more

Force Reload Even the Most Stubbornly Cached CSS Files

There’s nothing more frustrating than a machine that refuses to do what you tell it. “Reload the page” – a simple action, that can cause so much frustration because it just doesn’t work. CSS files often don’t get reloaded. Yes, we all know cache is to blame but how to get around it without drastic measures? Years of frustration have led me to this simple one-click solution that always works.

Read more

How to Regain Access to WordPress Admin Without a Username or Password

It’s a nightmare not being able to login to your WordPress site. You’re sure you have the right password, you even tried resetting the password, but nothing works. You’re locked out of your site. Thankfully there are fast methods of regaining access by modifying a few database records or a few files via FTP. As long as you have some access to the underlying server resources, you’ll be back in WP admin in no time.

Read more

Maintaining Free WordPress Plugins is NOT Free

Despite the widespread belief that can be distilled from rude comments & reviews on the wp.org plugin repo, maintaining a free plugin is not free. It doesn’t matter whether you charge for a plugin or not, hours still go into it! Due to an overwhelming amount of abandoned plugins in the repository, I decided to clarify a simple premise – how do free plugins get financed and why the lack of money is the number one cause of abandoned plugins.

Read more

How to Programmatically & Automatically Download, Install, Activate & Replace WordPress Plugins

Getting users to do anything is hard. Be it filling out a form or just performing a few clicks. Even if that action is for the users’ own good, they won’t do it. Same applies for getting users to install a required plugin, or even worse, replacing an active plugin with a new one. Thankfully, with a bit of code, we can download, install, activate, deactivate and even delete WordPress plugins. This automated process, can drastically improve user experience and increase conversion rates.

Read more

Use GeoIP to Transform Boring Data Into a Better User Experience

People are visual creatures. They like to see pretty things. I’m not saying this likely or because I enjoy it! It’s a hard, cold fact. Couple it with an ever decreasing attention span and rest assured your application is judged by appearance rather than by features or quality. If you’re a developer that can’t afford to pay for a custom GUI design for an app, this is especially devastating. Thankfully there are ways around this problem.

Read more

Clean up WordPress Theme HEAD Section & Unneeded JS & CSS Files

WordPress core ads quite a lot of code in site’s HTML head section whether you want it or not. That code is far from useless and serves a purpose on most sites. However, if you are a clean-code freak or using WordPress to power a SaaS you’ll want to clean up the HTML. As with most things in WP, it’s just a matter of removing a few actions and filters.

Read more

Dirty WordPress Debugging – How to Fix a Live Site Without FTP Access

Things break down. It’s a fact of life. Cars, refrigerators, phones, and websites – it’s all the same. However, nobody expects you to change the oil in a vehicle without having physical access to it. But some customers do expect you to debug and fix their websites without giving you complete admin access including FTP details. Crazy? It is! But it’s also not an uncommon scenario. Fortunately, there are ways to support such customers, if you decide to do so.

Read more

localStorage vs sessionStorage vs Cookies – a Detailed Comparison

Cookies have been with us for a long time. There’s nothing wrong with them, and they made the web a more pleasant place, but after nearly 25 years a lot has changed. Local Storage is and isn’t a replacement for cookies. That’s what’s most confusing about it. In most cases, you can safely use localStorage instead of cookies and get the wrong impression that they are the same, while they are not. Read on to see a no-nonsense breakdown of how and when to use localStorage to replace cookies.

Read more

How to Add WP-CLI Support to Any WordPress Plugin

Adjusting a plugin, to user’s needs is one of the main agendas every plugin owner has to follow. For a front-page slider that means more visual options. However, if you’re catering to developers, admins, and other power-users sooner or later, they’ll want CLI support. They’ll want to ditch the mouse and work only with the keyboard. Thanks to the WP-CLI project adding CLI support to your plugin is a piece of cake.

Read more

How to Rewrite a JavaScript Function into a jQuery Plugin

If you’re looking for an in-depth tutorial on writing a jQuery plugin, learning jQuery and JavaScript in general – this is not the article for you. There’s plenty of resources, both free and paid, covering those topics. What we’re exploring is a quick, real-world way of writing jQuery plugins that’ll help you in your day-to-day jQuery code. We won’t be writing code or plugins that get hosted on GitHub and used by thousands. We’ll write one-liners that speed up development.

Read more

How to Remove Default WordPress REST API Routes & Endpoints

WordPress REST API was introduced into the core in version 4.7 (Vaughan) in December 2016. Like any other significant change made on the WP core, it was fiercely debated (at the moment, July 2018, Gutenberg is the subject of such a debate/controversy). In the end, nothing happened. Those who didn’t care about the REST API still don’t care. Those who do care made some apps, integrations, plugins and other cool projects.

Read more

Rebranding reset-wp into WP Reset – The Story & Reasons Behind it

In May 2018 we acquired two plugins hosted in the WordPress repository – wp-reset and reset-wp (which will soon be removed from the repo, so don’t use it). The initial plan was to get only one, but in the end, we got both plugins which created some unique challenges. This is a story of how we merged two plugins, rebranded them and brought new life into them after years of sitting dormant in the repository.

Read more

How to Remove Default WordPress Rewrite Rules & Permalinks

WordPress permalinks, also known as rewrite rules or pretty links have been a feature since nearly the first version of WordPress. Once something to brag about, today this feature is as standard as features get and not even worth mentioning on the features list. Having numerous permalinks working out-of-the-box means that 99% of WordPress users don’t have anything to set up. However, there are situations where you want to remove or modify default permalinks.

Read more