Title: X-default tag implementation
Last modified: May 22, 2021

---

# X-default tag implementation

 *  [damiano874](https://wordpress.org/support/users/damiano874/)
 * (@damiano874)
 * [5 years ago](https://wordpress.org/support/topic/x-default-tag-implementation/)
 * Good morning,
 * I have a problem with implementation of x-default tag for my english language.
   I have searched whole internet for solution but could not find it. Someone was
   mentioning to check the following function:
 *     ```
       /**
       * Filters the list of rel hreflang attributes
       *
       * @since 2.1
       *
       * @param array $hreflangs Array of urls with language codes as keys
       */
       $hreflangs = apply_filters( 'pll_rel_hreflang_attributes', $hreflangs );
   
       foreach ( $hreflangs as $lang => $url ) {
       	printf( '<link rel="alternate" href="%s" hreflang="%s" />' . "\n", esc_url( $url ), esc_attr( $lang ) );
       }
       ```
   
 * But this function just generate html tags for each language without adding x-
   default tag.
 * Then, I have found sth like this:
 *     ```
       // Adds the site root url when the default language code is not hidden
       // See https://wordpress.org/support/topic/implementation-of-hreflangx-default
       if ( is_front_page() && ! $this->options['hide_default'] && $this->options['force_lang'] < 3 ) {
       $hreflangs['x-default'] = home_url( 'https://example.com' );
       }
       ```
   
 * But this one does not do anything for me.
 * I dunno if I have to switch off some settings within polylang to have it worked
   or how to modify exactly the code and which parts of it to get x-default tag 
   for my english language. Add somewhere website URL or whatever…
 * I dunno PHP and what exactly I have to change to get the x-default tag implemented.
   If someone can help I will appreciate it.

The topic ‘X-default tag implementation’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

## Tags

 * [x-default](https://wordpress.org/support/topic-tag/x-default/)

 * 0 replies
 * 1 participant
 * Last reply from: [damiano874](https://wordpress.org/support/users/damiano874/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/x-default-tag-implementation/)
 * Status: not resolved