[wp-hackers] What filter/action function to use to change posting date before publishing?
Chris G
cl at isbd.net
Tue Jan 26 21:33:29 UTC 2010
On Tue, Jan 26, 2010 at 12:47:58PM -0600, Otto wrote:
> On Tue, Jan 26, 2010 at 12:34 PM, Chris G <cl at isbd.net> wrote:
> > I'm a beginner at WordPress plugins (though an ancient programmer,
> > it's been my job since the early 1970s).
> >
> > I'm trying to write a very simple plugin that will adjust a post's
> > Published date after the post has been created or changed. I.e. I
> > want a hook that will call my plugin code when the Publish Immediately
> > or Update buttons are pushed before the post (or at least its date) is
> > written to the database.
> >
> > The most likely candidate I can find at the moment is the
> > content_save_pre filter though as it's the date I want to change I'd
> > simply return the content unchanged after changing the date in the
> > $post array.
> >
> > Am I on the right track? I'm a bit worried by some Google results
> > which say that content_save_pre is deprecated and even that it has
> > been removed from WordPress 2.9.1.
> >
>
> You probably want to use the wp_insert_post_data filter instead. This
> happens right before the post is updated or inserted into the
> database.
>
I had seen that but couldn't really understand what the difference
between "Sanitized post data" and "Raw post data" was. I'll have a
play though and see if I can make any sense of it.
Thanks.
--
Chris Green
More information about the wp-hackers
mailing list