WordPress站点Events Manager Pro与Qtranslate兼容问题:预订邮件#_LOCATIONNAME异常
Hey there, let's work through this issue where the #_LOCATIONNAME tag isn't displaying correctly in your booking emails when using Events Manager Pro and qTranslate. I’ve dealt with similar multi-language plugin conflicts with EM Pro before, so here are actionable fixes to try:
Verify qTranslate Language Tags for Locations
First, double-check that your location names are properly wrapped in qTranslate’s language tags. Head to your Events Manager location edit page, and ensure the name looks something like this:[:en]Central Park[:es]Parque Central[:]
Sometimes the auto-sync between EM Pro and qTranslate doesn’t catch location fields, so manually adding these tags ensures the system recognizes which language version to pull for emails.Add a Custom Filter to Override Tag Output
If the language tags don’t resolve the issue, you can use an Events Manager hook to force the tag to pull the correct language version. Add this code to your theme’sfunctions.phpfile (always backup the file first!):add_filter('em_event_output_placeholder', 'custom_em_qtranslate_location_name', 10, 3); function custom_em_qtranslate_location_name($replace, $placeholder, $event){ // Target only the #_LOCATIONNAME placeholder if( $placeholder === '#_LOCATIONNAME' && !empty($event->location_id) ){ $location = em_get_location($event->location_id); // Get the current active qTranslate language $current_lang = qtrans_getLanguage(); // Fetch the location name in the correct language $replace = qtrans_use($current_lang, $location->location_name, true); } return $replace; }This code intercepts the tag and uses qTranslate’s native function to output the location name matching the current language context when the email is sent.
Check Email Language Context
Sometimes the language environment when sending emails doesn’t match the user’s front-end language. If your site tracks user language preferences, you can adjust the hook above to use the user’s saved language instead of the site’s current language. For example, if you store the user’s language in user meta, replaceqtrans_getLanguage()with something likeget_user_meta($event->booking->user_id, 'user_language', true).Test for Plugin Conflicts
Temporarily disable all other plugins except Events Manager Pro and qTranslate, then send a test booking email. If the tag works, re-enable plugins one by one to find the conflicting one. Some caching or security plugins can interfere with tag parsing in emails.
Start with the first step—it’s the quickest fix in most cases. If that fails, the custom filter should reliably resolve the issue by directly connecting EM Pro’s tag system to qTranslate’s language handling.
内容的提问来源于stack exchange,提问作者mohamed mohmoud

