WordPress.org

Ready to get started?Download WordPress

Forums

Meta box issues (1 post)

  1. Adam
    Member
    Posted 2 years ago #

    So I was creating a meta box for a custom post type and everything works when you create a new post, the meta box displays the data you entered into and all that jazz, but if you ever need to edit that post then the meta box fields display undefined index of what ever the variable is your saving it into.

    I have discovered the issue is because the the url will change from:

    http://localhost:39705/wp-admin/post-new.php?post_type=ae

    to something like:

    http://localhost:39705/wp-admin/post.php?post=770&action=edit

    I have tried checking for $post->ID = $_POST['post'] or even 'edit' == $_POST['action'] but to no avail.

    So what do you do in this case when you have data saved and displayed in your meta box for a post you created but you keep getting "undefined index" when you go to edit?

    -- note: even if I take off the check of if $_post['post_type'] == 'ae' I get the issue of undefined index...

    For those looking to see whats going on in the code: I am your best friend

Topic Closed

This topic has been closed to new replies.

About this Topic