My Javascript Tools and Workflow Tips

It’s important for a modern front-end developer to have good tools and workflow that is going to survive the perpetually changing land of frameworks, ES specs, Typescript, and slightlybetterthanwhatyoudidyesterday.js craziness.

I’ve been working with modern JavaScript tools and frameworks for long enough to have nailed down a pretty good workflow, which I’ll share today. The tools I’ll talk about here work with different frameworks, even though I prefer Angular. These are especially important for working with teams using git.

I’ve mostly stolen it from better developers than me, so I take no credit for any of this. Let’s start with the essentials, Node and npm.

Continue reading

Javascript, APIs, and the Future of WordPress

Automattic just announced Calypso, which is a radical new interface for

It replaces the old admin experience with a faster, more modern approach. It uses a Javascript framework called React, which was developed by Facebook. The main advantage of React is that it’s supposed to allow development of web and mobile apps using a similar codebase. now uses an API to communicate with a Node server, instead of processing with PHP. The advantage of this is that it’s much faster and more interactive, and there are no page refreshes. It’s the same approach that makes many mobile and web apps tick, and it has the performance many users have come to expect these days.

This is a huge shift for, and it’s a major milestone for WordPress in general. Even though many sites and apps have already been taking this API driven approach, this marks a huge shift in WordPress development philosophy.

The question I’m wondering is, where is this all going? What does this shift mean for developers, products, and WordPress core?

I’ve been working with Javascript apps and WordPress APIs for over a year now, and I have a lot of thoughts on the subject.

Continue reading

Dealing with Custom Taxonomies in the WP-API

Update: this article focuses on the WP-API v1. Click here for an article on filtering with the WP-API v2 in WordPress 4.7+.

I have recently started working on a mobile app for a WordPress site that relies heavily on custom taxonomies.

The app needs to pull in posts from WordPress through the WP-API, and allow user filtering based on taxonomy. This requires some special handling, since custom taxonomies don’t appear in the WP-API by default.

What’s a custom taxonomy?

Taxonomies are for categorization. An example of a taxonomy is a category or a post tag.

For example, this post is in the ‘category’ of ‘wp-api.’ We can have lots of terms like wp-api, tutorial, blog, or personal under the name ‘category.’ A custom taxonomy could be swapping the word ‘category’ for something like ‘device.’ So we could have terms like ‘iPhone’, ‘Android’, and ‘Windows’ under our ‘device’ taxonomy.

For more on custom taxonomies, check out these references.

Creating custom taxonomies

Creating custom taxonomies uses the register taxonomy function. It’s similar to creating a custom post type, and just like a CPT, it won’t show up the WP-API unless we add show_in_rest = true.

To create a custom taxonomy that shows up in the WP-API, we could do something like this:

// hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_book_taxonomies', 0 );

// create two taxonomies, genres and writers for the post type "book"
function create_book_taxonomies() {
	// Add new taxonomy, make it hierarchical (like categories)
	$labels = array(
		'name'              => _x( 'Genres', 'taxonomy general name' ),
		// more labels here...

	$args = array(
		'hierarchical'      => true,
		'labels'            => $labels,
		'show_ui'           => true,
                'show_in_rest'      => true,
		'show_admin_column' => true,
		'query_var'         => true,
		'rewrite'           => array( 'slug' => 'genre' ),

	register_taxonomy( 'genre', array( 'book' ), $args );

The main thing to notice is the ‘show_in_rest’ argument, set to true.

Adding current taxonomies to the WP-API

If the taxonomy has already been created, or you don’t have access to the registration function, you can add the show_in_rest argument like this.

For a single taxonomy:

function sb_add_tax_to_api() {
    $mytax = get_taxonomy( 'genre' );
    $mytax->show_in_rest = true;
add_action( 'init', 'sb_add_tax_to_api', 30 );

For multiple taxonomies, something like this:

function sb_add_taxes_to_api() {
    $taxonomies = get_taxonomies( '', 'objects' );
    foreach( $taxonomies as $taxonomy ) {
	    $taxonomy->show_in_rest = true;
add_action( 'init', 'sb_add_taxes_to_api', 30 );

WP-API endpoint for custom taxonomies

After you’ve added your custom taxonomy to the WP-API using show_in_rest, you can navigate to the taxonomies or terms endpoint to see it in action.

For example, using the example of ‘genre’ from above, we could go to to see all of our genres. Let’s say we had a genre called ‘fiction’ with an ID of 212. To see information about only the fiction genre, we could visit

If we just wanted the structural information about the taxonomy, we could visit

If we wanted to get only the posts in a certain term (like fiction), we could make a GET request to[genre]=fiction. You could do the same for a custom post type (assuming you’ve added show_in_rest = true for the post type) by using the CPT’s endpoint:[genre]=fiction

I hope that helps! Let me know if you have any additional tips or questions in the comments.

4 Ways to Make Your Ionic App Feel Native

Recent developments in the hybrid world are blurring the lines between hybrid and native.

You can now use native transitions and native scrolling, along with a fast framework like Ionic. In many cases, it’s impossible to tell any difference between hybrid and native, since many fully native apps use WebViews.

The exciting thing is that hybrid apps are improving at breakneck speed, and it’s never been a better time to be in this field. There are 4 things that can drastically improve your apps and make them feel more native, let’s look at them now.

Continue reading

Working with Custom Post Types in WP-API v2

If you worked with the first version of the WP-API, you know that getting custom post types was really easy.

To get all posts, I could send a GET request to To get a specific type, I could send my request to

There have been some pretty big changes in version 2, which is the version that will (hopefully) be in WordPress core sometime soon.

Custom post types are now hidden from the API by default. I can see why they did this, many themes and plugins added post types that they never intended to be public. Making those public would cause more problems than it would solve.

However, that now means we can’t just add the ‘type’ flag to our request, and expect to get post types back.

Continue reading

Basic Authentication with the WP-API (v2) and AngularJS

Working on the WP-App Project, we need to use authentication to do certain things in the app. Deleting/approving comments, or listing users for example.

Basic Authentication is handy for testing code, but it should only be used in development, since you send the user/pass with every request. For production, you’ll want to use OAuth from an external client like a mobile app. I haven’t dug into OAuth yet, but it’s documented a little bit here.

We are using the Ionic Framework for the WP-App Project, which is based on AngularJS. Basic authentication requires sending the username and password, base64 encoded, in the request header. Here’s what that looks like.

Continue reading

The WP-App Project

Today I’m excited to announce the WP-App Project: a free, open-source mobile app for WordPress site management.

The idea is to create a customizable mobile app for WordPress site owners to manage their posts, pages, comments, media, etc.

What’s that you say, a WordPress app already exists? Ah, but not like this. No sir, not like this.

With this app, you’ll be able to write a simple plugin that adds a section to the app. Let’s say you are the developer of a successful forms plugin. You will be able to create an add-on for your product that adds management of form entries to this app, without touching any app code. An Ecommerce plugin developer could make a plugin that adds sales statistics to the app (with authentication of course).

Or say you just created a very custom site for a client, and they don’t use blog posts at all. You can remove the Posts page from the app, and instead add your custom CPTs.

This app uses the WP-API, which is very easy to interact with. It will be free and open-source, and I would love to have you help with the project.

This app is for you, it’s not for me. It’s not a product, and it’s not for sale. It’s so you can have a mobile app in your hands to hack and customize, without submitting anything to the app stores, or writing app code. Work with me to make this the coolest WordPress app ever.

This is not an AppPresser product, it’s totally open-source and free, but I wrote more about it on the AppPresser blog.

I need your help to make this app a reality, please read the post on the AppPresser blog to find out how you can help.


My 5 Favorite Business Blogs

Reading good blog posts is one of my favorite ways to learn about business.

There’s a lot of noise out there, lots of blogs are not worth reading. When your time is limited, it’s important you get to the good stuff quickly.

Here are the blogs I get solid, actionable business advice from consistently.

Continue reading

The Most Important Thing a Founder Does

Most companies start when someone has an idea, and they start making something: a product, a consultancy, a SaaS app, or whatever.

In the early days, the founder is really involved in making the product. If you are a technical founder, you write a lot of code, build your website, setup email marketing and other tools, etc.

As your company grows, your role changes, and you have to take off your “maker” hat to work on building your company. This is a difficult transition as a technical founder, because the only thing you know is making products.

Continue reading

The Minimum Viable Product

Minimum Viable Product

“Real artists ship.” –Steve Jobs

“If you’re not embarrassed when you ship your first version you waited too long.” –Matt Mullenweg

You’ve probably heard of an MVP, it stands for Minimum Viable Product.

The term was popularized by Eric Ries, It means that you should ship when you reach minimum viability, not a moment before or after that.

You shouldn’t take MVP to mean that you should ship a piece of crap. The emphasis in MVP is on viable, not on minimum.

Continue reading