【发布时间】:2017-11-15 13:51:54
【问题描述】:
我需要建议。插件开发人员向我提供了以下代码,以便将捐赠表格插入单个帖子模板,但我需要贝宝地址通过作者元自动引入帖子作者的电子邮件地址。这可能吗?
function multiple_paypal_accounts( $paypal_args, $payment_data ) {
$form_id = isset( $payment_data['post_data']['the-form-id'] ) ? $payment_data['post_data']['the-form-id'] : '';
if('3830' === $form_id ) {
// Here I want to customize the email address to show the post author's paypal email address
$paypal_args['business'] = 'THIS IS WHERE I NEED TO PULL IN THE PAYPAL ADDRESS FROM AUTHOR META DATA';
}
// Always return the paypal args.
return $paypal_args;
}
add_filter( 'the_form_paypal_redirect_args', 'multiple_paypal_accounts', 10, 2 );
【问题讨论】:
-
我的猜测是:global $post; $author_id=$post->post_author; $author_email = get_the_author_meta('email', $author_id );
标签: php wordpress function author