[wp-hackers] 3.5 and attachment_fields_to_edit (custom fields for media)

Steve Taylor steve at sltaylor.co.uk
Sun Oct 14 23:13:40 UTC 2012


Hi, thanks for the response.

I've updated the plugin (on GitHub, not yet wordpress.org) to work
with the new API. Yes, much easier :-)  Just a few tweaks and the code
I've got in place for post screen meta boxes works fine for 3.5
attachments.

I left my old code in for backwards compatibility. I'm checking on the
actual WP version, not on the existence of a hook. Maybe not always
the best way around, but I guess this means now I don't have to worry
about when you re-implement attachment_fields_to_edit for your
backwards compatibility...

Steve


On 14 October 2012 17:39, Andrew Nacin <wp at andrewnacin.com> wrote:
> On Tue, Oct 9, 2012 at 8:31 AM, Steve Taylor <steve at sltaylor.co.uk> wrote:
>
>> Hi,
>>
>> A plugin of mine
>> (http://wordpress.org/extend/plugins/developers-custom-fields/)
>> involves adding custom fields to media attachments via the
>> attachment_fields_to_edit hook. It looks like this method is broken in
>> the current beta of 3.5 due to moving media editing to post.php.
>>
>> Has anyone worked with this / posted about it? I've looked through the
>> Trac ticket (http://core.trac.wordpress.org/ticket/21391) and there
>> don't seem to be any hints for devs whose stuff this breaks.
>>
>> I'm ploughing into it now, just wondered if anyone else was ahead of
>> me! I'm guessing the new approach will be even easier to hook into
>> (using standard meta boxes) - but does legacy support just involve
>> leaving attachment_fields_to_edit stuff in place?
>
>
> Two things:
>
>  - Your plugin will probably become a lot simpler if it is updated to use
> the newer post type UI/API.
>
>  -  We are still doing backwards compatibility sweeps. We will continue to
> support attachment_fields_to_edit in a backwards compatible, deprecated
> fashion, it just doesn't yet. Thanks for the reminder on this hook in
> particular.
>
> Nacin
> _______________________________________________
> 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