【发布时间】:2020-01-31 08:34:02
【问题描述】:
我正在阅读 class-wc-structured-data,这是在 WooCommerce 插件中生成产品架构的关键文件。 我想知道为什么通过将简码(标签内容)插入 WooCommerce 文本编辑器(产品的完整描述)生成的内容无法被此代码重新定义:
'description' => wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) )
从文件中提取的完整内容是:
$markup = array(
'@type' => 'Product',
'@id' => $permalink . '#product', // Append '#product' to differentiate between this @id and the @id generated for the Breadcrumblist.
'name' => $product->get_name(),
'url' => $permalink,
'image' => wp_get_attachment_url( $product->get_image_id() ),
'description' => wp_strip_all_tags( do_shortcode( $product->get_short_description() ? $product->get_short_description() : $product->get_description() ) ),
);
是否有任何解决方案可以使插入到 WooCommerce 文本编辑器中的短代码内容在 WooCommerce 生成的架构中显示为“描述”?
【问题讨论】:
标签: php wordpress woocommerce schema product