WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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


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.