[wp-trac] Re: [WordPress Trac] #9073: wp_insert_post_data should
have access to categories and tags too
WordPress Trac
wp-trac at lists.automattic.com
Mon Feb 9 14:53:52 GMT 2009
#9073: wp_insert_post_data should have access to categories and tags too
-------------------------+--------------------------------------------------
Reporter: sirzooro | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 2.8
Component: General | Version: 2.7
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by filosofo):
If the post categories are set, they are passed to wp_insert_post_data.
Do something like this to access them:
{{{
add_filter('wp_insert_post_data', 'my_filter_callback', 10, 2);
function my_filter_callback($data = null, $arguments = null) {
// if they're defined, the categories are $arguments['post_category'];
// tags would be $arguments['tags_input'];
return $data;
}
}}}
However, that will allow you to change only core post data, not the
categories or tags themselves. To do that, use the "wp_insert_post"
filter.
--
Ticket URL: <http://trac.wordpress.org/ticket/9073#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list