Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 3 replies, has 3 voices.

Last updated by Long Nguyen 1 year, 3 months ago.

Assisted by: Long Nguyen.

Author Posts
March 5, 2024 at 7:14 pm #15376229

jasonA-19

Some of the pages are no index and we don't want to have hreflang attribute for them.
For example:
hidden link

HTML Source:
<meta name='robots' content='noindex, follow' />

<link rel="alternate" hreflang="en" href="hidden link" />
<link rel="alternate" hreflang="es" href="hidden link" />
<link rel="alternate" hreflang="x-default"
href="hidden link" />

Is it possible to remove hreflang attribute from such pages we are set as no index

March 5, 2024 at 7:31 pm #15376289

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

Thanks for contacting us.

Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

Please take a look at my colleague's response in this existing ticket to see if it gives you an insight:
https://wpml.org/forums/topic/remove-hreflang-tag-from-specific-pages/#post-11108651

In addition to that, I tried checking the example you shared but I got a 'The administrator has blocked your IP from accessing this website.' message.

Is it possible to temporarily disable this restriction just by the time that we check this?

Thank you, please let us know.

March 6, 2024 at 5:44 pm #15381184

jasonA-19

Hi Mateus,
The forum link you shared we already saw that before raising this ticket and as the forum post was way back from April 2022, was hopping that the options must have been present by now.

We have removed country blocking for all countries for now.
Please have a look and let us know if its possible to disable hreflang for some of the pages.

Regards
Amit
Link Right Media

March 7, 2024 at 3:46 am #15382076

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Jason,

Thank you for contacting WPML support, I’m happy to help you with this issue.

I think it is possible to use the filter hook "wpml_hreflangs_html" with a callback function to check a specific page and remove the hreflang. For example:

add_filter( 'wpml_hreflangs_html', function( $hreflang ) {
	if( is_tax( 'category', 2623 ) ) {
		$hreflang = '';
	}

	return $hreflang;
} );

Refer documentation
https://wpml.org/wpml-hook/wpml_alternate_hreflang/
https://developer.wordpress.org/reference/functions/is_tax/

Note: I would like to inform you that helping you with custom code, is out of the scope of WPML. If you are not able to accomplish this, I would recommend you contact one of our certified partners who will be more than happy to help you with this. In this link, you will find a list of our certified partners: https://wpml.org/contractors/

Thanks.

The topic ‘[Closed] Remove hreflang from noindex pages’ is closed to new replies.