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

I want to setup my WordPress so that whenever I create a post with the category “Tweet”, my wordpress installation automatically changes the post format from post to aside. This will help me because I want to use my wordpress for posting longer than 140 tweets to my twitter feed. The posting to twitter has been setup and it works.

The problem is that the WordPress iOS app doesn’t allow me to change the post format to Aside, so the only thing I can do is set the category of the post to “Tweet” and as soon as my wordpress receives it, it changes the post to aside.

Read More

I found the plugin “Set Aside” but it lets me change the post formats for all posts of a certain category that have already been posted, not the ones that I will post in the future.

Is this possible?

Related posts

Leave a Reply

1 comment

  1. 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' );
        }