skip to Main Content

I am using wordpress version 5.32 and elementor plugin (2.8)

While i am trying to customize and publish it raise an issue like:

<b>Notice</b>
: Trying to get property 'ID' of non-object in 
<b>/wordpress/wp-includes/post.php</b> 
on line <b>6534</b>
<br />

Line 6534:

function update_post_cache( &$posts ) {
    if ( ! $posts ) {
        return;
    }
    foreach ( $posts as $post ) {
        wp_cache_add( $post->ID, $post, 'posts' );
    }
}

and the change not geting updated in the website.

Disabling the elementor plugin will resolve this problem. How can i fix this issue with elementor plugin.

3

Answers


  1. Instead of

    $post->ID
    

    you can use:

    $post['ID']
    
    Login or Signup to reply.
  2. Try this

     function update_post_cache( &$posts ) {
        if (!$posts) {
            return;
        }
        foreach ($posts as $post) {
            wp_cache_add( $post['ID'], $post,'posts');
        }
    }
    
    Login or Signup to reply.
  3. Hope this helps :
    I had a siliar issue, I noticed that in de database, the table wp_posts had entries with the ID that had a value of 0.

    I deleted those entrys and added an AUTO_INCREMENT (that for some reason was not set) to the ID row of that table

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search