Plugin to set all Posts in a certain Category to a certain Post Format

Try putting this plugin in your wp-content/plugins folder and then activate it:

<?php

/*
Plugin Name: WPSE53245 - Set Tweet category posts as Aside
Plugin URI: http://http://wordpress.stackexchange.com/questions/53235
Description: Set Tweet category posts as Aside
Version: 0.1
Author: Ashfame
Author URI: http://wordpress.stackexchange.com/users/1521/ashfame
*/

    add_action( 'save_post', 'wpse53235_set_post_format_aside' );

    function wpse53235_set_post_format_aside( $postID ) {
        if ( has_post_format( 'aside', $postID ) || !has_term( 'tweet', 'category', $postID ) )
            return;
        set_post_format( $postID, 'aside' );
    }

Leave a Comment