I have a woocommerce site and want to have a mailto button for more information. I want the email to automatically populate the subject field with the product (post) title. I have found various options using php but nothing seems to work.
I have tried using the following mailto:
mailto:[email protected]?subject=Info request for [custom_mailto_title]
and then this php:
add_shortcode( 'custom_mailto_title', 'custom_mailto_title' );
function custom_mailto_title( $atts ) {
return esc_attr( get_the_title( get_the_ID() ) );
}
It looks like it should work but it doesn't and my understanding of php is limited
question from:
https://stackoverflow.com/questions/65871284/how-to-create-mailto-that-populates-subject-post-product-title 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…