Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deal with untranslated term taxonomy archives in the switcher menu.

  • Loading branch information...
commit d87e24912717e849c77e0b93ffde7120a448c8f2 1 parent f274fff
@simonwheatley simonwheatley authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 class-switcher-menu.php
View
8 class-switcher-menu.php
@@ -462,9 +462,13 @@ protected function add_post_type_archive_link( $lang ) {
**/
protected function add_taxonomy_archive_link( $lang ) {
$classes = array();
- if ( isset( $this->translations[ $lang->code ]->term_id ) ) { // Translation exists
+ $queried_object = get_queried_object();
+ if ( ! bbl_is_translated_taxonomy( $queried_object->taxonomy ) ) {
+ $this->add_arbitrary_link( $lang );
+ return;
+ } elseif ( isset( $this->translations[ $lang->code ]->term_id ) ) { // Translation exists
bbl_switch_to_lang( $lang->code );
- $href = get_term_link( $this->translations[ $lang->code ], bbl_get_base_taxonomy( $this->translations[ $lang->code ]->taxonomy ) );
+ $href = get_term_link( $this->translations[ $lang->code ], bbl_get_base_taxonomy( $queried_object->taxonomy ) );
bbl_restore_lang();
$title = sprintf( __( 'Switch to %s', 'bbl' ), $lang->names );
$classes[] = 'bbl-existing';
Please sign in to comment.
Something went wrong with that request. Please try again.