[wp-hackers] What filter/action function to use to change posting date before publishing?

Otto otto at ottodestruct.com
Tue Jan 26 18:47:58 UTC 2010


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.

-Otto



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.
>
> Any/all comments and help welcome.
>
> --
> Chris Green
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list