WordPress.org

Ready to get started?Download WordPress

Forums

Ryu
[resolved] Notice: Trying to get property of non-object (5 posts)

  1. rebelangel
    Member
    Posted 5 months ago #

    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!

  2. 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!

  3. rebelangel
    Member
    Posted 5 months ago #

    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.

  4. Konstantin Obenland
    Theme Wrangler
    Posted 5 months ago #

    Hi rebelangel,

    Thank you for bringing the bug to our attention! We updated the theme on WordPress.com 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: https://cloudup.com/ceYDHhF9Bem

    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.

    Best,
    Konstantin

  5. rebelangel
    Member
    Posted 5 months ago #

    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.

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.