我正在使用一个插件,为每个woocommerce订单生成一个邮政编号,这与Woocommerce订单号不同。我想将该帖子ID号码保存到Post Meta订单中,并在不同的PHP页面上显示,例如Woocommerce电子邮件通知页面。
我试图通过cookie从Woocommerce Thankyou页面获取该ID,并在电子邮件通知中显示它们,但是在最后一个过程中运行ThankYou.php页面,并且电子邮件通知页面在thankyou页面之前工作,因此不起作用。
if ( ! function_exists( 'yith_wcevti_set_args_mail_template' ) ) {
/**
* Define the args to mail template
* @param $post
* @return array|mixed|void
*/
function yith_wcevti_set_args_mail_template($post)
{
$args = array();
$post_meta = get_post_meta($post->ID, '', true);
这段代码在我的插件的功能页面中,我想从这里保存$ post-> ID到Post Meta并显示到任何Wordpress或PHP页面。
任何帮助表示赞赏。
尝试kw update_post_meta或add_post_meta可能对您有所帮助