Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using WooCommerce for my store, and I need to be able to extend the Coupon post type... I need to add a selectable attribute of membership_term ...

How do you extend a CPT created by another plugin? Is there an official hook that I'm not seeing to be able to modify an existing CPT?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I am not sure exactly what you are trying to 'extend', or how you want to extend it, but you can alter posts types with add_post_type_support, remove_post_type_support, and a few other functions.

You can add metaboxes to the post type with add_meta_box setting the $post_type argument to the name used to register your post type. (Examples are on the Codex page) Unless the original plugin provided a hook you won't be able to directly alter its metaboxes but you can use remove_meta_box to remove existing boxes and then add back a near clone of the metabox with your changes.

You will have to hook into save_post or admin_action_{$_REQUEST[action]} to save any additional fields you create.

share|improve this answer
    
So for example, the post type has a meta box with a bunch of attributes ... I need to add another one, so that when the post type is saved, it will be included. –  dcolumbus Nov 23 '12 at 19:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.