Archived topic
Trying to get property 'ID' of non-object
6 replies · Started by Michael on January 29, 2021
I'm seeing the following (with debug mode on), but only when looking at a specific backend admin page (for the Pods plugin). Obviously the first four relate to another plugin, but the fifth one points at the GP theme.
Notice: Trying to get property 'ID' of non-object in /Users/Michael/mampsites/ks-demo5/wp-content/plugins/slide-anything/php/slide-anything-admin.php on line 437
Notice: Trying to get property 'ID' of non-object in /Users/Michael/mampsites/ks-demo5/wp-content/plugins/slide-anything/php/slide-anything-admin.php on line 438
Notice: Trying to get property 'ID' of non-object in /Users/Michael/mampsites/ks-demo5/wp-content/plugins/slide-anything/php/slide-anything-admin.php on line 439
Notice: Trying to get property 'ID' of non-object in /Users/Michael/mampsites/ks-demo5/wp-content/plugins/slide-anything/php/slide-anything-admin.php on line 440
Notice: Trying to get property 'ID' of non-object in /Users/Michael/mampsites/ks-demo5/wp-content/themes/generatepress/inc/meta-box.php on line 52
Here are the corresponding lines of code:
$info_added = get_post_meta($post->ID, 'sa_info_added', true);
$info_deleted = get_post_meta($post->ID, 'sa_info_deleted', true);
$info_duplicated = get_post_meta($post->ID, 'sa_info_duplicated', true);
$info_moved = get_post_meta($post->ID, 'sa_info_moved', true);
if ( $blog_id && (int) $blog_id === (int) $post->ID ) {
Do you think the error is with GP (and Slide Anything) or Pods?
Many thanks
Hi there,
does the notice still appear if you temporarily disable the Slide Anything plugin ?
Yes the error notice does still appear (but obviously the other four Slide Anything errors aren't there).
BTW, I do have some PHP functions on the site, but only via Snippets (i.e. nothing in functions.php), and I've also tried disabling all those without finding the culprit.
Hi there,
The last one there looks like something we can fix in the next GP version.
The other ones are from that plugin - you'll need to report it to them.
Thanks for the heads up!
Thanks Tom and David,
Good to know, and yes - I'll be in touch with Slide Anything.
Cheers
Hello again - re-starting this thread as the same thing is happening for me (line 52 again).
GeneratePress Version 3.0.4
GP Premium Version 2.0.3
It seems to be triggered by the Pods backend admin screens. Here's some details around the notice (from Query Monitor):
Level: Notice
Message: Trying to get property 'ID' of non-object
Count: 1
Location:
wp-content/themes/generatepress/inc/meta-box.php:52
generate_register_layout_meta_box()
wp-includes/class-wp-hook.php:294
do_action('add_meta_boxes')
wp-content/plugins/pods/ui/admin/setup-edit.php:156
PodsView::get_template_part()
wp-content/plugins/pods/classes/PodsView.php:116
PodsView::view()
wp-content/plugins/pods/includes/classes.php:231
pods_view()
wp-content/plugins/pods/classes/PodsAdmin.php:1268
PodsAdmin->admin_setup_edit()
wp-content/plugins/pods/classes/PodsUI.php:5725
PodsUI->callback_action()
wp-content/plugins/pods/classes/PodsUI.php:1777
PodsUI->edit()
wp-content/plugins/pods/classes/PodsUI.php:1639
PodsUI->go()
wp-content/plugins/pods/classes/PodsUI.php:575
PodsUI->__construct()
wp-content/plugins/pods/includes/classes.php:53
pods_ui()
wp-content/plugins/pods/classes/PodsAdmin.php:1079
PodsAdmin->admin_setup()
wp-includes/class-wp-hook.php:292
do_action('toplevel_page_pods')
wp-admin/admin.php:259
I've added it to the 3.1.0 milestone here: https://github.com/tomusborne/generatepress/issues/246
Thanks!