Support » Theme: Ryu » Notice: Trying to get property of non-object

  • Resolved rebelangel


    Hello folks,
    After upgrading to 3.8.1 I am getting the following notice whenever I add a new post or page only. the notice disappears once I save the post or page. (it’s only appearing on the dashboard, not on the site).

    Notice: Trying to get property of non-object in /home/public/wp-includes/post-template.php on line 29

    I have googled extensively but to my frustration, my noob-php-code-fu skills are not yet up to the task of figuring out how to fix this specific instance. I have disabled all plugins; it’s not a plugin conflict. However, the error only appears when either Ryu or the Ryu-child theme I am using are activated, so I hoped that support here could help me sort this out. And perhaps other users are seeing this too?

    Many thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Kathryn


    Automattic Happiness Engineer

    Hi there, do you have debugging mode turned on for that site?

    Check your wp-config.php – do you see a line like this?

    define('WP_DEBUG', true);

    Debugging notices shouldn’t be active on live sites; they’re meant for testing purposes only. Try turning debugging mode to off by setting it to false:

    define('WP_DEBUG', false);

    I’ll report the error to the developers so it can be fixed in a future version. Thanks for the report!

    Yes, I do have debugging mode on. I’m trying to use it to learn — I will set it to false, though. Thank you! I am glad that the report may be of use.

    Hi rebelangel,

    Thank you for bringing the bug to our attention! We updated the theme on and will push out the fix with the next update to Ryu.

    Since you’re trying to get more familiar with PHP, let me get into more detail on how we fixed it:

    get_post_ID() relies on the global post object being available, which is the case when WordPress displays posts on the front-end, or when you edit a post in the admin. In cases where you create a new post, that global object is not always available, the current post ID is being passed to the action hook though, and we can rely on that.


    Konstantin, it is so kind of you to take the time to explain. I really appreciate it…and I THINK I get it! Many, many thanks for the generous spirit behind your note.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Notice: Trying to get property of non-object’ is closed to new replies.