Help with -> Warning: Creating default object from empty value
-
I’m building a custom theme for my portfolio and learning as I go. I made a rookie mistake which I desperately need assistance with.
My theme will has both default and custom posts with categories that will be queryable and displayed on separate pages. The default post category queries go to category.php, but the the custom post’s were giving a 404, which I was in the process of working out. For some reason one of the custom post categories would send me to category.php and display a default post that wasn’t even an active post in my admin panel. It was something I had either deleted or changed.
I decided to make sure everything was cleared out so I deleted all of these posts from the phpMyAdmin panel. I accidentally also deleted the blog page as well. I created a new blog page and menu item for it and now I get these errors
Warning: Creating default object from empty value in /Applications/MAMP/htdocs/wordpress6/wp-admin/includes/nav-menu.php on line 407
Notice: Undefined property: stdClass::$ID in /Applications/MAMP/htdocs/wordpress6/wp-admin/includes/nav-menu.php on line 410
This is the function that it’s referring to. The first line code starts on line 405 of the file:
if ( ! empty( $posts_page ) ) { $posts_page_obj = get_post( $posts_page ); $posts_page_obj->posts_page = true; $important_pages[] = $posts_page_obj; $suppress_page_ids[] = $posts_page_obj->ID; }
I really don’t know where to start with this or why I’m getting it since I simply replaced the page and menu link with the same thing that was deleted. I’m doing this locally on MAMP btw.
- The topic ‘Help with -> Warning: Creating default object from empty value’ is closed to new replies.