P2 Resolved Posts: Only mark a specific category as unresolved

In the WordPress.org forums, ameeromar asks:

Hey would it be possible to limit the automatically marking as unresolved to one category? This would be particularly useful for my category ‘tasks’ which need to be marked as unresolved when published (and then marked as resolved when completed).

It’s totally possible using a combination of a couple filters. Here’s what the annotated code snippet looks like:

[code lang=”php”]
* P2 Resolved Posts: Only mark ‘task’ posts as unresolved
* @see http://danielbachhuber.com/2013/04/18/p2-resolved-posts-only-mark-a-specific-category-as-unresolved/
// Marks all new posts as unresolved
add_filter( ‘p2_resolved_posts_mark_new_as_unresolved’, ‘__return_true’ );
// Let us apply conditional logic to when posts are marked unresolved
add_filter( ‘p2_resolved_posts_maybe_mark_new_as_unresolved’, ‘p2rpx_only_mark_tasks’, 10, 2 );
function p2rpx_only_mark_tasks( $ret, $post ) {

// Get all of the categories assigned to the post
$cats = get_the_terms( $post->ID, ‘category’ );
// Make sure this didn’t return false or a WP_Error object
if ( is_array( $cats ) ) {

// Use wp_filter_object_list() to see if there are any ‘task’ terms
$task = wp_filter_object_list( $cats, array( ‘slug’ => ‘task’ ) );
// If there is a task term, we want to mark unresolved. Otherwise, no.
if ( ! empty( $task ) )
$ret = true;
$ret = false;

return $ret;

However, in a stock P2 install, there isn’t a frontend interface for setting the category. The category is determined by the post format you use. Other users might be better off searching for tags by switching the term lookup to: get_the_terms( $post->ID, 'post_tag' );

P2 Resolved Posts v0.3: Register your own post states

P2 Resolved Posts is a nifty plugin we use at Automattic, in conjunction with the stellar P2 theme, to help better ensure decisions aren’t left hanging and things get done. This third release of the plugin allows you to register your own custom post states.

For instance, if I wanted to have a post “Waiting Review” before it was marked unresolved, I could add something like the following to my theme’s functions.php:

P2ResolvedPosts()->add_state( 'waiting-review', 'Waiting Review', array( 'before' => 'unresolved' ) );

The third argument is the position of the state. It can be ‘first’ or ‘last’, or ‘before’ => ‘state’ or ‘after’ => ‘state’.

Alternatively, you can remove a state if you no longer find it useful.

Getting this feature out the door required a fair amount of refactoring. It’s been running stable on WordPress.com for a couple of weeks — the most awesome way to beta test. Feel free to post any feedback, issues, feature requests, etc. in the WordPress.org forums. You can also fork the plugin on Github.

P2 Resolved Posts v0.2: Mark new as unresolved and audit log

P2 Resolved Posts is a nifty plugin we use at Automattic, in conjunction with the stellar P2 theme, to help ensure decisions aren’t left hanging and things get done. This second formal release of the plugin incorporates the following:

  • Automatically mark new posts as unresolved by adding add_filter( 'p2_resolved_posts_mark_new_as_unresolved', '__return_true' ); to your theme’s functions.php. Thanks macmeister for the request.
  • Audit log records who changes the post state and when they change it. View the audit log by hovering over the action link.
  • wp-cli command for the plugin includes a subcommand for programmatically changing the state of a post.
  • Includes a POT file for localization. Translations welcome!
  • Displays an error notice if you’ve activated the plugin but P2 isn’t the currently active theme.

Fork the plugin on Github. In particular, I’d love to see an interface for assigning a post to yourself. Please post any feedback, issues, feature requests, etc. in the WordPress.org forums.

New plugin: P2 Resolved Posts

P2 Resolved Posts on the VIP P2

On Friday, I finally pushed P2 Resolved Posts live in the WordPress.org directory. Based on Nacin’s gist of the same name, it’s a “lightweight GTD plugin for WordPress and the P2 theme.”

Mark a thread as “unresolved” when the topic needs resolution, and mark it as “resolved” when you’ve achieved that state. There are also sidebar widgets to let you see all unresolved posts, optionally filtered to a specific tag.

We use P2 extensively at Automattic, for a variety of purposes. I improved Nacin’s code last November because I wanted a simple way to encourage the culture of coming to a resolution on a topic. All too often, conversations are left hanging. This is a problem for those participating, and an even larger problem for those reviewing the conversation at a later date.

The plugin is in-development on Github. Please post any feedback, issues, feature requests, etc. in the WordPress.org forums.

Automattic has me spoiled

Automattic has me spoiled. Today, I sat through an hour-long conference call and a two hour committee meeting. Let’s say an average of ten people were attending each. If each person makes an average of $30/hour, the conference call cost $300 and the committee meeting cost $600. And… the content of both was largely status updates.

P2 needs a better marketing landing page so I can more easily sell it to every group I’m a part of.