How to exclude URLs from the generator’s target URLs

How to apply

Insert following filter to functions.php on your theme.

Code

add_filter( 'ShifterURLS::CheckURL', function ($correct_link, $link));

Return false to the paths, you want to exclude.

Limitations

  • URLs should be provided or by WordPress.

  • URLs to CSS, JS or other assets are not excluded.

Sample

Sample Code A

Omit URLs that contain /archive/ from the Generator’s target URLs.

In this sample, the function expands regular expressions of the given URLs and compares them. Then it returns `false if URLs contain /archive/.

add_filter( 'ShifterURLS::CheckURL', function ($correct_link, $link) { 
// omitting every URLs which contains /archive/ from the Generator's target URLs.
if ( preg_match( '#/archive/#', $link ) ) {
$correct_link = false;
}
return $correct_link;
}, 10, 2);

Take the Next Step

Get started on your website today with Shifter. Try out our free plan and take the first step towards building the perfect website for you and your visitors.

Copyright © 2023 DigitalCube

A product by

Check out our other products