Last active
October 8, 2021 20:37
-
-
Save lelandf/c9eca5604f55a2e5586e1de1e66dc160 to your computer and use it in GitHub Desktop.
[TEC] Remove events/feed link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Might be overengineering this with the str_contains polyfill | |
// Just checking to see if the string contains "events/feed" before returning null | |
// @link https://www.php.net/manual/en/function.str-contains.php#Hcom126277 | |
// @link https://developer.wordpress.org/reference/functions/get_post_type_archive_link/ | |
if ( ! function_exists( 'str_contains' ) ) { | |
function str_contains( string $haystack, string $needle ) { | |
return empty( $needle ) || strpos( $haystack, $needle ) !== false; | |
} | |
} | |
add_filter( 'post_type_archive_feed_link', function( $link ) { | |
if ( str_contains( $link, 'events/feed' ) ) { | |
$link = null; | |
} | |
return $link; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment