是否可以将页面重定向到产品标签?在此之前,我使用产品类别来做到这一点,并且有效。因此,我更改了代码以使用产品标签对其进行重定向,但此方法不起作用
img = r'D:\SriSailam.jpg'
img = cv2.imread(img)
img = cv2.resize(img,(300,300))
imgToDisplay = img
img = img.transpose((2,0,1))
img = img.reshape(1,3,300,300)
...
rect = cv2.rectangle(imgToDisplay, (xmin, ymin), (xmax, ymax), (0, 0, 255), 1)
预先感谢
答案 0 :(得分:1)
function so_38101217_template_redirect() {
if ( function_exists( 'is_product_tag' ) && is_product_tag( 'raya-2020' ) ) {
$redirect_page_id = 9905; // adjust to ID of page you are redirecting to
wp_redirect( get_permalink( $redirect_page_id ) );
exit();
}
}
add_action( 'template_redirect', 'so_38101217_template_redirect' );
尝试此代码-在活动主题中的functions.php中添加此行