[wp-hackers] Change post_status of image attachments

Otto otto at ottodestruct.com
Wed Jan 13 20:54:41 UTC 2010


Attachment post statuses are always "inherit".

This is set in wp_insert_attachment, which is called from
wp_update_post, which is called after the attachment_fields_to_save
filter runs.

So in other words, you can't change the post_status because it's being
forced to "inherit" for all attachments, always.

-Otto

On Wed, Jan 13, 2010 at 2:38 PM, Matthew Gerring <mgerring at emrl.com> wrote:
> Hello all. Hoping someone can shed some light on a filter with some weird behavior.
>
> I'm trying to use "attachment_fields_to_save" to set the post status of images. I was able to add a "post status" field to the media edit screen, and I can pass the value in that field into the database, but not if I'm trying to update the post_status. The code is here: http://wordpress.pastebin.com/m1dd87fdc
>
> If anyone could shed some light on why I can't change that particular value, that'd be super extra awesome.
> _______________________________________________
> 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