How Disable Specific Pages AMP to AMP Automatic Link WordPress

ilustration mobile redirect to amp
ilustration mobile redirect to amp

Cilacap.info English – Hi blogger friends, does your website use wordpress platform and you use AMP (Accelerated Mobile Pages) on your blog.

If it is true that you use wordpress and set amp mode template to Transitional, but will disable AMP to AMP internal link, continue to read guidelines on how to disable it.

The method is very easy and simple, you only need to add code in functions.php in theme you are using.

For example, you don’t want all pages /tags/ don’t want links contained in AMP to go to /tag/blablavla/?amp, then below is code you can use.

add_filter( ‘amp_to_amp_linking_element_excluded’, function ( $excluded, $url ) {
if ( false !== strpos( $url, ‘/tag/’ ) ) {
$excluded = true;
}
return $excluded;
}, 10, 2 );

It easy isn’t it, so if you disable a specific page, for example category, you just have to change code /tag/ to /category/.

Cilacap Info
FOLLOW MORE NEWS ONGOOGLE NEWS

Related News