Remove words from the_excerpt_rss() with php
-
I have followed this tutorial : https://www.wpbeginner.com/wp-tutorials/how-to-create-custom-rss-feeds-in-wordpress/ to create a custom feed.
The main objective is to create a new feed that will not have the two words “Photo Credits” that are present in each item’s excerpt of the regular WordPress RSS feed.
So I thought in my custom feed template I could use something like:
<?php $excerptWithoutCredits=the_excerpt_rss(); $excerptWithoutCredits=str_replace('Photo Credits', '', $excerptWithoutCredits); ?>
and then:
<description><![CDATA[<?php echo $excerptWithoutCredits; ?>]]></description>
but this is not working, nothing is displayed. It looks like I can’t retrieve the_excerpt_rss() in a variable?
How can I do exactly to remove those two words from the_excerpt_rss() ?
Thanks
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Remove words from the_excerpt_rss() with php’ is closed to new replies.