Fatal error: Access level to .... ::read_children() must be public (as in class ....)

Fatal error: Access level to .... ::read_children() must be public (as in class ....)

我有问题 更新 woocommerce 后出现此问题

感谢您的帮助

致命错误: AtWCTourDataStoreCPT::read_children() 的访问级别必须是 public(如 class WC_Product_Variable_Data_Store_CPT) /home3/abrobadg/public_html/wp-content/themes/adventure-tours/includes/classes/AtWCTourDataStoreCPT.php 第 58 行

enter image description here enter image description here

  1. 首先制作一个backup/copy这个文件:\wp-content\themes\adventure-tours\includes\classes\AtWCTourDataStoreCPT.php

  2. 将这两个函数的可见性从 protected 更改为 publicline 25 and 29 like这个:

protected function read_children (...” to “public function read_children (....

protected function read_variation_attributes( ....” to “public function read_variation_attributes( ....

对我有用

将 read_children 更改为 read_parent,将 read_variation_attributes 更改为 read_parent_attributes,如下面的代码所示:

受保护的函数read_parent( &$product, $force_read = false ) { return $this->is_variable( $product ) ? parent::parent( $product, $force_read ) : array(); }

受保护的函数read_parent_attributes( &$product ) { return $this->is_variable( $product ) ? parent::read_variation_attributes( $产品 ) : array(); }