将此函数放入functions.php
在wp-include
文件夹:
function maybe_unserialize( $original ) {
if ( is_serialized( $original ) ) {
$fixed = preg_replace_callback(
\'!(?<=^|;)s:(\\d+)(?=:"(.*?)";(?:}|a:|s:|b:|i:|o:|N;))!s\',
\'serialize_fix_callback\',
$original );
return @unserialize( $fixed );
}
return $original;
}
function serialize_fix_callback($match) { return \'s:\' . strlen($match[2]); }