qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
553 stars 104 forks source link

Cannot use action/filter hooks in theme #405

Open herrvigg opened 6 years ago

herrvigg commented 6 years ago

Issue by owiekindisch Monday Jul 11, 2016 at 18:01 GMT Originally opened as https://github.com/qTranslate-Team/qtranslate-x/issues/405


Hello,

I'm not able to use the action qtranslate_init_language or filter i18n_admin_config and qtranslate_load_admin_page_config in the theme functions.php because the plugin files and your code executes before the theme files are loaded. A solution would be if you hook your initialization with add_action( 'init', ... );

herrvigg commented 6 years ago

Comment by johnclause Monday Jul 11, 2016 at 18:06 GMT


hooking in 'init' is "too late", the language has to be detected and set right in the beginning, since many things depend on language in other plugins and in the theme. Find another way, you do not have to use functions.php for that purpose.