How to Get WP RSS Aggregator Feed to Validate

I’m using the plugin WP RSS Aggregator, and I couldn’t get the custom feed to validate in other places. The validator said that it was missing an <author> field. If an item doesn’t have an author, then the feed doesn’t even supply an empty one.

The way to fix it is to go to wp-content/plugins/wp-rss-aggregator/templates/custom-feed/entry.twig and where you see

    {% if item.author|length > 0 %}
        <author>
            <name>{{ item.author }}</name>
            {% if item.author_email|length > 0 %}
                <email>{{ item.author_email }}</email>
            {% endif %}
            {% if item.author_link|length > 0 %}
                <uri>{{ item.author_link }}</uri>
            {% endif %}
        </author>
    {% endif %}

add an else statement like this:

 {% if item.author|length > 0 %}
        <author>
            <name>{{ item.author }}</name>
            {% if item.author_email|length > 0 %}
                <email>{{ item.author_email }}</email>
            {% endif %}
            {% if item.author_link|length > 0 %}
                <uri>{{ item.author_link }}</uri>
            {% endif %}
        </author>
    {% else %}
        <author><name></name></author>
    {% endif %}

It will now validate even if there is no author in the RSS item.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Contact

3420 Pump Rd. #181
Henrico, VA 23233

+1 804 430 9444

Contact Us

Connect