Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Notice: Undefined index: when adding post #25

Closed
Nick-Lancaster opened this issue Sep 21, 2013 · 4 comments
Closed

Notice: Undefined index: when adding post #25

Nick-Lancaster opened this issue Sep 21, 2013 · 4 comments

Comments

@Nick-Lancaster
Copy link

Hi,

I'm receiving an error when I try to add a new post registered with SuperCPT.

These errors only appear when the post is being added and don't seem to effect the data being stored. they disappear when editing the post.

Probably best illustrated by the attached images:
When posting
screen shot 2013-09-21 at 11 16 54 am
When editing
screen shot 2013-09-21 at 11 17 10 am

My code placed in functions.php is as follows:

function setup_custom_posts() {
    if ( ! class_exists( 'Super_Custom_Post_Type' ) )
        return;

    $workshops = new Super_Custom_Post_Type( 'workshop' );

    $workshops->add_meta_box( array(
        'id' => 'details',
        'fields' => array(
            'synopsis' => array( 'type' => 'textarea' ),
            'workshop-date' => array( 'type' => 'date' ),
            'venue' => array( 'type' => 'input' )
        )
    ) );

}
add_action( 'after_setup_theme', 'setup_custom_posts' );

I'm developing locally on a mac using MAMP, not sure if that makes any difference?

Any help much appreciated.

Thanks

@harmputman
Copy link

Exact same issue here. Also on line 298 in class-super-custom-post-meta.php. Never had this problem before!

@tnguyen14
Copy link

I'm having this problem as well

@tnguyen14
Copy link

One way to fix this issue for now is to add a blank default option when declaring the field

$cpt->add_meta_box(array(
    'fields' => array(
        'field' => array(
            'type' => 'text',
            'default' => ''
        )
    )
);

@mboynes
Copy link
Owner

mboynes commented Apr 20, 2014

See #23

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants