无法在 elementor 中加载预览 issue/error

Preview could not be loaded issue/error in elementor

我正在使用自定义模板,当我在为该页面选择模板后尝试在 elementor 插件中打开任何页面时,它显示错误:“无法加载预览”,我必须启用安全心情,以便在 elementor 中打开该页面。

模板代码:-

<?php 
/**
    Template name: Master Template  
*/
wp_head();
get_header();
?>

<body>
    
<?php 
if(have_posts()):
    while(have_posts()):
        the_post();
        the_content();
    endwhile;
endif;
?>
</body>

<?php 
get_footer();
?>

我找到了 2 个解决方案 解决方案一:-

Before going further, 99% of the time, this error usually caused by running out of memory. To resolve this, you must increase the PHP memory_limit variable. The recommended memory limit is 512MB. Do this.

方案二:-

Deativate all plugins and activate them one by one to see if one of them is conflicting

这些解决方案对我不起作用,关于解决方案 1,我已经有 memory_limit 512MB,关于解决方案 2,只有 1 个插件激活是 elementor。 我应该怎么做才能摆脱这个错误?有什么我想念的吗?

我得到了我的解决方案:-

当我更改当前主题时,错误消失了,我使用的主题是:20 20,但是当我将它从 20 20 更改为 20 17 时,错误消失了,我的插件元素开始工作得很好。

当我深入调试时,我才知道我没有使用 wp_footer() 和 get_footer(),因为我使用了这个函数(在 old/using 主题中),问题消失了。

代码如下:-

<?php 
/**
    Template name: Master Template  
*/
wp_head();
get_header();
?>

<body>
    
<?php 
if(have_posts()):
    while(have_posts()):
        the_post();
        the_content();
    endwhile;
endif;
?>
</body>

<?php 
get_footer();
wp_footer();
?>

希望对大家有所帮助。