Web & Software Developer

Archive for “WordPress Code Snippets”

WordPress code snippets, quick tips, and tutorials to help you design and customize your own Wordpress themes and plugins.

4 Ways To Add Custom Code To Your WordPress Website

In my WordPress help articles and documentation, you’ll find some articles that have custom code with instructions to “add this code to your functions file,” or “add this filter,” or “add this action,” or something like that. Here are four different ways that you can use to add custom functions or filters or actions to […]

MailChimp API Version 3.0 Signup Form for WordPress

Add a MailChimp API Version 3.0 Signup Form To WordPress Without a Plugin

This is the most lightweight way to add a MailChimp email signup form using their API v3.0. This uses only 89 lines of code, no plugin. This lightweight MailChimp subscription form assumes you want users to subscribe to your email list. This code disables “Double Opt-in” which means that users will NOT be sent a […]

Delete WordPress Post Revisions, With Related Meta and Terms

This snippet will delete WordPress post revisions, along with any related meta and terms. Rather than delete post revisions using a $wpdb query, this uses wp_delete_post which takes care of removing related meta, taxonomy terms, etc. IMPORTANT NOTE: You should only run this snippet once. There are several ways to make sure of this. Some […]

Detect if WP Time Format is in 24-hr Format

This function lets you detect if the Time Format in WordPress settings is set to a 24-hour format. It returns true if the Time Format is in a 24-hour format, otherwise it returns false. (The Time Format is also known as the ‘time_format’ option, and you can get it like this: get_option( ‘time_format’ ).)