Title: Exclude current language using the custom language switcher code
Last modified: January 2, 2025

---

# Exclude current language using the custom language switcher code

 *  Resolved [ebarcena](https://wordpress.org/support/users/ebarcena/)
 * (@ebarcena)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/exclude-current-language-using-the-custom-language-switcher-code/)
 * I’m currently using this custom language switcher to display as footer links 
   on my website:
 *     ```wp-block-code
       <?php $array = trp_custom_language_switcher();  ?><?php if ( apply_filters( 'trp_allow_tp_to_run', true ) ){ ?>	<?php foreach ($array as $name => $item){ ?>		<a href="<?php echo $item['current_page_url']?>"> 			<span><?php echo $item['language_name']?></span>		</a>&thinsp; &middot; &thinsp;	<?php } ?><?php } ?>
       ```
   
 * This works fine, but it displays all languages available. How can I exclude the
   site’s current language from displaying?
 * Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexclude-current-language-using-the-custom-language-switcher-code%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Anca](https://wordpress.org/support/users/ancavictoria/)
 * (@ancavictoria)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/exclude-current-language-using-the-custom-language-switcher-code/#post-18227640)
 * Hello,
 * Could you please test the following code and confirm that it works as you wish?
 *     ```wp-block-code
       <?php $array = trp_custom_language_switcher();  ?><?php if ( apply_filters( 'trp_allow_tp_to_run', true ) ){ ?>	<?php foreach ($array as $name => $item){ ?>        <?php if( $item['language_code'] != get_locale() ) : ?>		    <a href="<?php echo $item['current_page_url']?>"> 			    <span><?php echo $item['language_name']?></span>		    </a>&thinsp; &middot; &thinsp;        <?php endif; ?>	<?php } ?><?php } ?>
       ```
   
 * Kind regards,
 * Anca
 *  Thread Starter [ebarcena](https://wordpress.org/support/users/ebarcena/)
 * (@ebarcena)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/exclude-current-language-using-the-custom-language-switcher-code/#post-18229196)
 * It works perfectly. Thank you much.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Exclude current language using the custom language switcher code’ is 
closed to new replies.

 * ![](https://ps.w.org/translatepress-multilingual/assets/icon.svg?rev=3166541)
 * [TranslatePress - Translate Multilingual sites with AI Translation](https://wordpress.org/plugins/translatepress-multilingual/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/translatepress-multilingual/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/translatepress-multilingual/)
 * [Active Topics](https://wordpress.org/support/plugin/translatepress-multilingual/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/translatepress-multilingual/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/translatepress-multilingual/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [ebarcena](https://wordpress.org/support/users/ebarcena/)
 * Last activity: [1 year, 5 months ago](https://wordpress.org/support/topic/exclude-current-language-using-the-custom-language-switcher-code/#post-18229196)
 * Status: resolved