Advanced Custom Fields
[resolved] Undefined Index line 500 (3 posts)

  1. sickhippie
    Posted 4 years ago #

    After creating a new post type, when I go to create a new post of that type, I get a series of Undefined Index errors stemming from line 500 of acf.php.

    The fix is simple - change $post_type to $post->post_type.

    This is just an informative post for the dev since advancedcustomfields.com is currently down.


  2. Michael Rimbach
    Posted 4 years ago #

    You can also change it to $GLOBALS['post_type'].

    Please fix it.

  3. sickhippie
    Posted 4 years ago #

    It's personal preference, of course - I prefer $post->post_type for readability, but I would also swap $GLOBALS['post_type'] at line 432 with $post->post_type as well. Since the global $post object is called at the beginning of the function (line 414), it just makes more sense to me to call the attribute of that object rather than pulling it from $GLOBALS. Regardless, undefined index errors aren't major, but they do fill up the error logs a bit, which can cause actual problems to get lost in the shuffle.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic