Skip Navigation

[Resolved] Split: email notifications.

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#1998649

You can get the admin email set at WP Admin -> Settings -> General, by using the "get_bloginfo":
https://developer.wordpress.org/reference/functions/get_bloginfo/


$admin_email = get_bloginfo( 'admin_email' );

And to get the current "vakexpert" post's author email, you'll need to use "get_post_field" and "get_the_author_meta" functions:
https://developer.wordpress.org/reference/functions/get_post_field/
https://developer.wordpress.org/reference/functions/get_the_author_meta/


$vakexpert_author_id = get_post_field( 'post_author', $parent_id );
$vakexpert_author_email    = get_the_author_meta( 'user_email', $vakexpert_author_id );

And these can be combined in the fine code snippet, by replacing the line:


$to = 'abc@xyz.com';

With:


$admin_email = get_bloginfo( 'admin_email' );

$vakexpert_author_id = get_post_field( 'post_author', $parent_id );
$vakexpert_author_email    = get_the_author_meta( 'user_email', $vakexpert_author_id );

$to = $admin_email.','.$vakexpert_author_email;

#1998737

My issue is resolved now. Thank you very much Waqar!