WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Adding a Meta Box to an Existing Post Type

[Resolved] Adding a Meta Box to an Existing Post Type

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matthew Boynes

    @mboynes

    Correct, you do not want to declare a new Super_Custom_Post_Type for psots or pages. Instead, you’ll want to instantiate Super_Custom_Post_Meta and pass it ‘post’ or ‘page’, then you can call add_meta_box on that object. Something along the lines of:

    $post_meta = new Super_Custom_Post_Meta( 'post' );
    $post_meta->add_meta_box( ... );

    For future reference, you can find all the documentation here, which covers doing this.

    Hi Matthew,

    Thanks for the support!
    This works, however, when I use this functionality the connect_types_and_taxes function does not work to connect custom taxonomies to this post type
    —————–
    Call to undefined method Super_Custom_Post_Meta::connect_taxes

    Plugin Author Matthew Boynes

    @mboynes

    That is correct. As mentioned in the docs, you can only pass Super_Custom_Post_Type and Super_Custom_Taxonomy objects through connect_types_and_taxes.

    To connect a custom taxonomy to an existing post type, call the method connect_post_types on the Super_Custom_Taxonomy object and pass it the post type. For instance,

    $authors = new Super_Custom_Taxonomy( 'author' );
    $authors->connect_post_types( 'post' );

    Great!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Adding a Meta Box to an Existing Post Type’ is closed to new replies.