Skip to content

Commit

Permalink
Detect WP_Error returned by bbl_get_post_lang_code and bomb out, rath…
Browse files Browse the repository at this point in the history
…er than treating it as the actual lang and breaking later. Fixes #74
  • Loading branch information
simonwheatley committed Oct 30, 2012
1 parent 8fffabe commit f68a8f4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions miscellaneous.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ function bbl_admin_init() {
} }
} else { } else {
$post_lang_code = bbl_get_post_lang_code( $post_id ); $post_lang_code = bbl_get_post_lang_code( $post_id );
if ( is_wp_error( $post_lang_code ) )
return;
if ( $post_lang_code != $cur_lang_code ) { if ( $post_lang_code != $cur_lang_code ) {
$url = add_query_arg( array( 'lang' => $post_lang_code ) ); $url = add_query_arg( array( 'lang' => $post_lang_code ) );
wp_redirect( $url ); wp_redirect( $url );
Expand Down

0 comments on commit f68a8f4

Please sign in to comment.