Skip to content

Instantly share code, notes, and snippets.

@MrVibe
Created June 13, 2022 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrVibe/bbddd1e2da9593625573fbcc7cde525f to your computer and use it in GitHub Desktop.
Save MrVibe/bbddd1e2da9593625573fbcc7cde525f to your computer and use it in GitHub Desktop.
Verify if App page is loaded in correct language.
add_action('template_redirect',function(){
global $post;
if(is_page(vibebp_get_setting('bp_single_page'))){
$wpml_page_id = apply_filters('wplm_object_id',$post_id,'page');
if($post->ID != $wpml_page_id){
$new_url = str_replace(get_permalink($post->ID),get_permalink($wpml_page_id),$_SERVER['REQUEST_URI']);
wp_redirect($new_url);
exit;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment