在过去的两周里,我已经在这个问题上与优雅主题和WPEngine进行了斗争,而且我和其中任何一个都无处可去。
以下是日志中的一个错误:
[Wed Apr 26 20:37:29.797099 2017] [:error] [pid 9802] [client 192.104.203.89:55604] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 218817933 bytes) in /nas/content/live/amberrein/wp-content/plugins/monarch/monarch.php on line 4279, referer: http://www.amberreinhardt.com/category/weddings/
我已经通过wp-config.php提高了内存限制:
define( 'WP_MEMORY_LIMIT', '1024M' );
define( 'WP_MAX_MEMORY_LIMIT', '1024M' );
因内存泄漏而非常受欢迎。有些博客文章很好,有些则不是。然后,我回去看一个工作岗位,然后因为泄漏而没有加载,所以无论出于何种原因,它都会发生变化。我不知道。并且内存泄漏量总是不同,但永远不会高于我设置的限制。但是,似乎限制越高,如果加载一个帖子加载所需的时间越长,这很奇怪。
这是我认为导致错误的整个功能。第4279行以$content
开头:
function display_media($ content){ $ monarch_options = $ this-> monarch_options;
if ( $this->check_applicability( $monarch_options[ 'sharing_media_post_types' ], 'media' ) ) {
preg_match_all( '/<img [^>]*>/s', $content, $images_array );
foreach ( $images_array[0] as $image ) {
if ( false !== strpos( $image, 'class="ngg_' ) ) {
continue;
}
preg_match( '@src="([^"]+)"@' , $image , $image_src );
$icons = $this->generate_media_icons( $image_src[1] );
$replacement = '<div class="et_social_media_wrapper">' . $image . $icons . '</div>';
$content = str_replace( $image, $replacement, $content );
}
}
return $content;
}
我可以做些什么来解决这个问题,因为优雅的主题和WPEngine没有帮助?我不想要禁用该插件,因为客户希望保留它。