In version 1.3.1 of postie, it is now easy to add custom filters to the content of your posts. Best of all, by using filters, you can easily write your own plugin, which will not be affected by upgrades to postie (as opposed to modifying the postie functions directly). There are two examples now included in version 1.3.1 of postie, in the filterPostie.php file. Here is how to write your own filter.
- Copy the filterPostie.php into your plugins directory
- Change the metadata at the top of the file, such as the author and plugin name
- Modify the example functions to your liking, or create your own
- Activate the plugin
A few more details. After modifying the headers, you might have something like the following:
URI: http://mywebsite
Description: Adds a custom field to each post called postie
Version: 0.1 Author: Joe Bloe
Author URI: http://mywebsite.com
*/
Just as with any filter for wordpress, you have 2 parts.
- A function which receives an argument, makes some modifications (filtering) and returns a result
- A function call to add this new function to the list of filters for a certain action
As you can see in the example file, I have created two functions, filter_title, and filter_content. After creating these functions, I then “hook” them into postie using the add_filter function.
add_filter('postie_post', 'filter_content');
Now lets create our new function to add a custom field
//this function appends "(via postie)" to the title (subject)
add_post_meta($post['ID'], 'postie', 'postie');
return ($post);
}
Finally, we let wordpress know that this function should filter any post that is sent via postie
Currently our function is really not that useful, since the key and value of our custom field are the same. However, there is really very little limit to what we can do with filters. Perhaps a more useful function would be an auto- tagger. Suppose I often write about cooking, wordpress, and latex (which I do). But when I am posting via e-mail, I frequently forget to add tags. We could write a little filter function to read the body of the post, and automatically add tags depending on the content. Here is what it might look like:
// this function automatically inserts tags for a post
$my_tags=array('cooking', 'latex', 'wordpress');
foreach ($my_tags as $my_tag) {
if (stripos($post['post_content'], $my_tag)!==false)
array_push($post['tags_input'], $my_tag);
}
return ($post);
}
add_filter('postie_post', 'auto_tag');
I’m sure that users will come up with many other interesting filters. If you develop any you would like to share, please post them on the postie forum


Fat Cow wrote:
Hello!
I have translate your plugin into russian language and send You files. but You ignore me. when You publish this? Please answer me to email!
robfelty wrote:
Fat Cow,
Thanks for the translation. I hope to include it in the next release of postie.
Rob
elias wrote:
great work!!!!!!! i love this plugin, it’s exactly what i was looking for!
there is only one problem with the latest release 1.3.3, maybe you can have a look at the forum for wordpress-plugins:
http://wordpress.org/support/topic/281891?replies=8#post-1212440
seems like there have more people the same problem and no solution :-(
for the while i step back to version 1.3.2 until a sloution for the probelm with the attachments is available.
greetings elias.
Max wrote:
Hello, how do you get youtube embed videos to work? Thanks in advance =D
Dave Bergschneider wrote:
Can Postie set the post status to “Pending” instead of Published by default? I can’t seem to figure out how to do that.
paolo wrote:
Dear
you are a genius, self seats and is exceptional in all its aspects, easy to use and track you have been really good … congratulation and thanks.
I have a question: You can delete a post via email?
thanks Paul