Last active
April 28, 2024 18:57
-
-
Save kadimi/c0b4c8f918524d403848b2eb048377c0 to your computer and use it in GitHub Desktop.
SportsPress: Replace line breaks with `\n` in iCal feeds
This file contains 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 | |
add_filter('posts_results', function($posts, $query) { | |
if (empty($_GET['feed']) || $_GET['feed'] !== 'sp-ical') { | |
return $posts; | |
} | |
foreach ($posts as &$post) { | |
$post->post_content = preg_replace("/\r?\n/", "\\n", $post->post_content); | |
} | |
return $posts; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment