共計 1528 個字符,預計需要花費 4 分鐘才能閱讀完成。
今天,丸趣 TV(wanqutv.com) 小編收到某新手站長的幫助求求,說升級出現了錯誤。網站文章管理頁和其它頁面后臺都打不開了,感覺升級后果很嚴重,怕網站因此而打不開了。其實,這完全不用擔心,這個升級錯誤其實很多做的比較大的博主也有發生過。
WordPress 升級出錯:preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 1 in wp-includes/class-wp.php on line 222
中文意思是: 警告:preg_match():編譯失?。毫吭~在第 222 行的 wp-includes / class-wp.php 中的偏移量 1 處未跟隨可重復項
下面,我們來仔細看一下解決方案:
具有頁面類型帖子,訂單類型帖子或帖子的任何頁面都會顯示此錯誤。這僅在托管環境中可見。我無法在本地復制錯誤。
我們可以按此順序執行以下操作:
1、停用所有插件
2、轉到設置 -> 永久鏈接并重新保存 %postname% 選項
3、驗證錯誤仍然存??在,沒有插件和固定鏈接重置。
4、更新了所有插件和主題。
5、驗證錯誤仍然存??在。
6、在本地執行相同的步驟,但無法復制此問題。
注意: 有時候很可能就是插件問題導致的(后臺容易出現),當然也可能是主題(前端容易出現),小編幫助這個新手站長停用所有插件,刷新錯誤頁面,沒有正常。然后,又重新啟動了所有插件,再刷新錯誤頁面,恢復正常了。還有,如果真的是插件問題,可以慢慢挨個停用插件,直接停用哪個插件后,恢復正常,那可能就是插件兼容性問題或其它相關問題!
來自 class-wp.php:
foreach ((array) $rewrite as $match => $query ) {
// If the requested file is the anchor of the match, prepend it to the path info.
if (! empty( $requested_file) && strpos($match, $requested_file) === 0 && $requested_file != $requested_path ) {
$request_match = $requested_file . ‘/’ . $requested_path;
}
if (preg_match( “#^$match#”, $request_match, $matches) ||
preg_match(“#^$match#”, urldecode( $request_match), $matches ) ) {
if ($wp_rewrite->use_verbose_page_rules && preg_match( ‘/pagename=\$matches\[([0-9]+)\]/’, $query, $varmatch ) ) {
// This is a verbose page match, let’s check to be sure about it.
$page = get_page_by_path($matches[ $varmatch[1] ] );
if (! $page) {
continue;
}
$post_status_obj = get_post_status_object($page->post_status);
if (! $post_status_obj->public && ! $post_status_obj->protected
&& ! $post_status_obj->private && $post_status_obj->exclude_from_search ) {
continue;
}
}
// Got a match.
$this->matched_rule = $match;
break;
}
}