0

I am trying to create a custom post type (through a plugin). The post type must be pretty similar to a page, so I would like to load meta boxes from other plugins and theme in my custom post type.

I registered my post type like this :

register_post_type('product', array(        
    "labels" => $labels,
    "description" => "Product", 
    "menu_icon" => 'dashicons-media-text',
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'menu_position' => 20,
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'page',
    'exclude_from_search' => false,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail','revisions' )
)); 

How load metadbox plugin loaded like this :

add_meta_box("page-meta", "settings", "pageMeta", "page", "normal", "low");

Is there a way to inherit of page metaboxes ?

2
  • I don't know what the question means. Are you trying to ask if there a way to load metaboxes intended for another post type?
    – s_ha_dum
    Commented Oct 23, 2015 at 14:05
  • Yes, it is. I would like to load metabox from type "page" to my custom post type.
    – Inglebard
    Commented Oct 23, 2015 at 15:02

1 Answer 1

0

The short answer is you can try but it just won't be any kind of reliable. There was a similar question while back — get registered metaboxes by post type or post ID

Overall it is somewhat possible to fetch metaboxes like that, but it was never designed to work like that. Also it's common for related code to check for post type (to not mess up unrelated ones) so it won't work properly, even if meta box shows us.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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