Using wp_remote_get() to parse JSON from remote APIs

WordPress includes an exceptionally useful API called the HTTP API that can be used for sending data to and retrieving data from remote APIs. If you are building a plugin that talks to Stripe, MailChimp, or just about any other service that provides an API, you can use the WP HTTP API to make your job significantly easier. For this tutorial, I’m going to show you how to use wp_remote_get(), one of the several functions included in the HTTP API, to retrieve and parse JSON data from a remote API.


Unit Tests for WordPress Plugins – The Factory

For many plugins, writing adequate unit tests requires the creation of sample post, user, taxonomy, and other data inside of the test WordPress install. While the standard WordPress functions for creating data, such as wp_insert_post(), work just fine, WordPress provides a set helper classes called WP_UnitTest_Factory that make it exceptionally simple.


Shortcodes 101 – Shortcode Attributes

In the Basics of the Shortcode API, we briefly covered shortcode attributes and the shortcode_atts() function. Now it is time to dive deep into setting up attributes for shortcodes and learn a few tricks can that be exceptionally helpful when building shortcodes in your plugins or when modifying the shortcodes of other plugins.


Determine if a script has been enqueued or registered

WordPress provides a nice, simple API for loading scripts in plugins and themes. We use the wp_enqueue_script() and wp_register_script() to instruct WordPress to load the scripts we need, and it works exceptionally well. Sometimes, however, we don’t need to just load a script, but instead we need to detect if a specific script has been…

Error: Please enter a valid email address

Error: Invalid email