Recently I was talking to another developer about how to detect ‘WP_DEBUG’ being set on a WordPress installation. Here is the code I use.
WordPress Plugin
Sending WordPress Emails Through Gmail
Typically, if you’re sending any volume of email or sending emails to visitors you’ll want to use a third-party. Sometimes, you only need to send yourself notifications and are having deliverability problems with these notifications – this is the case, where you may want to send your emails through Gmail’s SMTP.
Modern Tribe Events Calendar Replace Default Event Link with Event Website
When using the WordPress plugin [The Events Calendar](https://theeventscalendar.com/) by Modern Tribe the default link in the calendar will point to the Event page. However, sometimes we want to point this link to the Event Website value (which we can set when creating the event). This is the code I use to do this.
How to Add a Twitter Hashtag with Scriptless Social Sharing
When using Scriptless Social Sharing, you may want to add a site wide hashtag to all of your tweets. This is the code you can use to do that.
ACF Uncaught TypeError: Cannot read property ‘id’ of undefined
Recently I was working on a site using Advanced Custom Fields (ACF) and the field input boxes had stopped working. In the browser console, I saw the error “ACF Uncaught TypeError: Cannot read property ‘id’ of undefined”.
Install a non-wordpress.org Plugin with WP CLI
The WordPress plugin repository at wordpress.org/plugins is a great resource. I often use WP CLI to install plugins on my WordPress site from there, however, sometimes I want to install other plugins with WP CLI.
Gravity Forms Default Value and Caching
I’m a big fan of the Gravity Forms Form builder WordPress plugin. I came across an interesting issue on a project where I was using the default value functionality and I wanted to make some notes as a warning for others (and myself) in the future.
Remove target _blank from the Scriptless Social Sharing Email button
I like to use the Scriptless Social Sharing WordPress plugin to add Share buttons to my blog posts. Recently I had a client notice that because the Email Share button has target=”_blank” in the HTML markup, it opens a new tab when clicked. This is great behavior if you’re using web based email (e.g. Gmail), however if you’re using an email application on your computer, you end up with a blank tab. This code removes target blank from the email share link.
Apply Bootstrap Classes to Gravity Forms Button
When working on a project, using Gravity Forms and Bootstrap, I wanted to style the buttons with Bootstrap. This code allows me to modify the markup output by the Gravity Forms WordPress plugin to use the Bootstrap classes.
functions.php vs plugin vs mu-plugin for WordPress
It is common for articles on writing WordPress code to refer to adding the code to the functions.php file in the active theme. This is one location where code can be added but it isn’t always the best. Places to Add WordPress Code a new file in wp-content/mu-plugins a new plugin in wp-content/plugins the functions.php […]