Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
试图获得财产';ID';在Wordpress的wp includes/post.php中使用非对象_Php_Wordpress_Elementor - Fatal编程技术网

试图获得财产';ID';在Wordpress的wp includes/post.php中使用非对象

试图获得财产';ID';在Wordpress的wp includes/post.php中使用非对象,php,wordpress,elementor,Php,Wordpress,Elementor,我正在使用wordpress版本5.32和elementor插件(2.8) 当我试图自定义和发布它时,会引发如下问题: <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 /> 网站上没有更新更改 禁用elemen

我正在使用wordpress版本5.32和elementor插件(2.8)

当我试图自定义和发布它时,会引发如下问题:

<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 />
网站上没有更新更改

禁用elementor插件将解决此问题。如何使用elementor插件解决此问题。

而不是

$post->ID
您可以使用:

$post['ID']
试试这个

 function update_post_cache( &$posts ) {
    if (!$posts) {
        return;
    }
    foreach ($posts as $post) {
        wp_cache_add( $post['ID'], $post,'posts');
    }
}
希望这有助于: 我有一个siliar问题,我注意到在de数据库中,表
wp\u posts
中有
ID
的条目,其值为
0


我删除了这些条目,并在该表的
ID
行中添加了一个
AUTO_INCREMENT
(由于某种原因未设置)您是否更改了一些代码?没有更改php代码。第一个提示,unistall插件并重新安装,否则第6534行的post代码卸载并重新安装并没有解决问题
我在这里使用第6534行的代码:``函数更新'后缓存(&$posts){if(!$posts){return;}foreach($post)后缓存($post){wp_缓存添加($post->ID,$post,'posts');}``请更新不在这里的问题。为什么您认为这可能与当前的问题有关?你从哪里得到同样的错误?
 function update_post_cache( &$posts ) {
    if (!$posts) {
        return;
    }
    foreach ($posts as $post) {
        wp_cache_add( $post['ID'], $post,'posts');
    }
}