You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress站点Events Manager Pro与Qtranslate兼容问题:预订邮件#_LOCATIONNAME异常

Fixing #_LOCATIONNAME Tag in Events Manager Pro Booking Emails with qTranslate

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’s functions.php file (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, replace qtrans_getLanguage() with something like get_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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:15:33