Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有可能ID仅通过知道它来获得 WooCommerce 产品slug?我需要在产品页面之外获取产品价格。
ID
slug
使用现有函数 get_page_by_path();
$product_obj = get_page_by_path( $slug, OBJECT, 'product' );
更好的解释:
https://wordpress.stackexchange.com/questions/206886/get-product-details-by-url-key-in-wordpress-woocommerce