【问题标题】:Notice: id is called in the wrong way. The properties of the product should not be directly accessible注意: id 以错误的方式调用。不应直接访问产品的属性
【发布时间】:2019-12-03 08:40:16
【问题描述】:

注意:id est appelée de la mauvaise manière。 Les propriétés du produit ne doivent pas être access directement。回溯:require('wp-blog-header.php')、require_once('wp-includes/template-loader.php')、include('/themes/accesspress-parallax/page.php')、get_template_part、locate_template、 load_template, require('/themes/accesspress-parallax/content-page.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, YITH_YWRAQ_Shortcodes->request_quote_page, wc_get_template, include(' /plugins/yith-woocommerce-request-a-quote-premium/templates/request-quote.php'), wc_get_template, include('/plugins/yith-woocommerce-request-a-quote-premium/templates/request-quote -view.php'), WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Veuillez lire Débogage dans WordPress (en) pour plus d'informations。 (Ce message a été ajouté à la version 3.0.)在 /home/sites/equipalg/public_html/site/wp-includes/functions.php 第 4778 行

ps:我使用插件 YITH WooCommerce Request A Quote Premium 和 WooCommerce 任何帮助或建议将不胜感激!

【问题讨论】:

标签: wordpress forms plugins woocommerce notice


【解决方案1】:

此通知被抛出是因为自 woocommerce 3.0(已弃用)以来您无法直接调用产品的 id,您应该改用 get_the_id() getter 来获取产品的 id。

【讨论】:

    【解决方案2】:

    为此,您需要先使用全局关键字,例如

    global $woocommerce, $product;
    

    【讨论】:

    • 请问我将在哪里使用它们?
    猜你喜欢
    • 2021-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-21
    • 2015-02-19
    • 2012-08-13
    相关资源
    最近更新 更多