WordPress comes pre-packaged with a robust REST API that’s great for certain use cases, but it also poses some security risks and concerns. If I’m you’re not using the REST API actively, it may be best to disable it. There is a plugin that will do this for you called Disable REST API, but it’s…
As I upgrade older sites to use jQuery 3.3.1 I commonly encounter the following error: Uncaught Error: Syntax error, unrecognized expression: … This error occurs when you are trying to select something with an invalid selector. jQuery 2.x and 3.x handle Sizzle related errors differently than 1.x, and will throw an Error in circumstances where…
Google provides a set of lesser known, but highly useful, operators that can be used to refine and finely tune search results. These operators are incredibly useful when optimizing and analyzing websites for organic search. Below is a reference of the various operators, or symbols/words, that you can use in Google searches to make results more precise.
Over the past 10 years as freelance web developer I’ve learned important lessons about business, relationships, money and life.
If you’re tired of manually re-formatting, indenting, structuring or beautifying HTML code in Sublime Text then you can use the following approach to automatically indent HTML files when you Save. Manual Auto-indent for HTML Based on common questions the following manual approach is provided. If you don’t want to do this on Save you can…
Markdown is a wonderful way to write content on the web, it’s what I use to write every blog article you see here on kevinleary.net. While working with Upstatement’s Timber plugin I came across a situation where I wanted to provide Markdown support for custom field content in a custom WordPress theme. Timber provides a…
If you want to change the wording of an admin menu inside of WordPress without editing the plugin directly you can make use of the $menu global variable that exists within the WordPress admin. Manipulating this data structure will allow you to change the text or name of an admin menu that was added by…
The tutorial will show you how to setup and work with Angular.js inside of a WordPress plugin to create a stand-alone, API powered, Angular.js single page app or microsite that is available at a defined path of a WordPress website. Live Demo GitHub Source By the end of this tutorial you should grasp a few key…
I find myself doing this all the time, so I wanted to make note of the snippet here for anyone else commonly looking to add a Git remote for an existing Heroku app using the Heroku CLI. Open up your Terminal and enter the following commands to quickly link an existing Git project with one…
I picked up a strange issue on my WordPress site today while reviewing stats in Google Search Console. I noticed a malicious 301 redirect happening for an old post, one that had no redirect rules set. Specifically the post had a 301 redirect set to send traffic to seonix.org, which is definitely a malicious site.…
If you want to use regex for an Express.js route rule then you must use a JS regular expression object instead if string by wrapping your regular expression in slashes (/) instead of quotes (“). To look at a common usage example, let’s say you want the same route handler for two different root paths…
Angular’s built-in $http service and it’s $http.get() method do NOT cache responses by default. There are a few different ways you can enable $http caching, below are some helpful examples of each. These examples are ordered in terms of difficult, beginning with what’s easiest and most common. 1. Built-in $http Cache You can quickly enable…
Angular’s templating system is wonderful, and it build’s on some common practices established years ago by the Handlebars templating engine. Sometimes I encounter projects where an existing templating system conflicts with Angular, such as a server-side templating language like Mozilla’s Nunjucks or PHP’s popular Twig template engine. In these situation it’s often handy to change…
This is the best way I’ve found to create an Angular.js directive that’s restricted to a specific HTML element or tag. There’s no directive configuration option in Angular.js to do this, but I recommend adding the `restrict: ‘A’` to your directives config so that it only matches an attribute name. Once we have that in place the key aspect that makes this happen is this line: if ( element[ 0 ].tagName !== “A” ) { … }