-
-
Save ashwebstudio/a6d47b88690c6bd7a9eb27b8968972bd to your computer and use it in GitHub Desktop.
I have a proble using this. I'm trying to use this code in a custom wordpress php page initiated like that: define( 'WP_USE_THEMES', true ); require_once( $_SERVER[ 'DOCUMENT_ROOT' ] . '/wp-load.php' ); On those pages the value of $TRP_LANGUAGE is everytime "es_US" Any idea?
Seems like something to ask the TranslatePress people about, but since that is a non-standard way of doing things in WordPress I don't think they will have much of an answer for you. Might have to dig into the code to see when $TRP_LANGUAGE actually gets set by TranslatePress and find another way to make it work OR do something within normal WordPress.
Thank you.
I think I understood where the problem is.
If I am on a page like: https://mysite.com/it/page, $TRP_LANGUAGE is it_IT.
But if I go to the home page WITHOUT THE SLUG (https://mysite.com) $TRP_LANGUAGE revert to en_US. And the same happens with custom pages.
This means that by default TranslatePress does not remember user last visited language. The sell an add on to do that (didn't knew).
I have a proble using this. I'm trying to use this code in a custom wordpress php page initiated like that:
define( 'WP_USE_THEMES', true );
require_once( $_SERVER[ 'DOCUMENT_ROOT' ] . '/wp-load.php' );
On those pages the value of $TRP_LANGUAGE is everytime "es_US"
Any idea?