Trying to overwrite category through filter
-
I understand Postie has the ‘starts with logic’ but I’m trying to make it more robust for my case by using a PHP switch case to set the category based on a specified words found in the subject line. And so $new_category would be assigned to $post[‘post_category’].
Before even inserting the switch, I just tried overwriting the post’s category using $post[‘post_category’] = 44; and $post[‘post_category’] = ‘news’; but neither worked (‘news’ is an existing category). Instead, the posts just got assigned the default “General” category.
filterPostie.php:
add_filter('postie_post_before', 'filter_customized'); function filter_customized($post) { $post['post_title'] = 'News Update'; //this works just an example $post['post_category'] = 44; // neither of these work $post['post_category'] = 'news'; return $post; }
Thank you.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Trying to overwrite category through filter’ is closed to new replies.