woocommerce - Woocommerce Hook 上的语法错误(T_ENCAPSED_AND_WHITESPACE)
问题描述
我在这个函数中遇到了这个错误消息,我没有看到字符有任何问题。
语法错误,意外的“cfwc_save_cus”(T_ENCAPSED_AND_WHITESPACE)
function cfwc_save_custom_field( $post_id ) {
$product = wc_get_product( $post_id );
$title = isset( $_POST['custom_description'] ) ? $_POST['custom_description'] : '';
$product->update_meta_data( 'custom_description', sanitize_text_field( $title ) );
$product->save();
}
add_action( 'woocommerce_process_product_meta', 'cfwc_save_custom_field' );
解决方案
推荐阅读
- python - 我写了这个python代码,但每次它都给我错误的答案
- ios - 如何将我的数据转换为 JSON 格式 - 健康应用
- formik - Formik setStatus 未更新 - formik.status 未定义
- javascript - Livewire 和用于缩放图像的内联 js 脚本存在问题
- node.js - 在 postgreSQL 中使用测试数据库更好地测试 Express 路由
- internet-explorer - 在 Internet Explorer 上使用 mouseenter 和 moseleave 闪烁淡出
- angular - 使用在同一模块上声明的 Angular 组件
- javascript - 从 Javascript 创建跳转到页面
- javascript - 导入“dayjs/local/en”时出错?
- javascript - [Vue 警告]:观察者“childItems”的回调错误:“TypeError:无法读取未定义的属性‘标签’”