• Resolved acann

    (@acann)


    Hi, I have WPML installed with two languages:
    English (default) – mydomain.com
    French – mydomain.com/fr

    This means the RSS feeds are:
    mydomain.com/feed/ – includes English and French posts
    mydomain.com/fr/feed/ – created by WPML plugin, only shows posts with the French language

    The issue is that in order to separate my mailchimp campaigns by language, I need a feed which only has the English posts. The main feed will include both English and French. I know I could configure WPML to place the default language in a directory as well (mydomain.com/en) and this would solve this issue, but in my case I do not want the default language in a directory, only alternate languages.

    Does anyone know how I can either:
    A) Alter the main feed so that it EXCLUDES French posts
    B) Create a custom RSS feed which only displays English posts
    C) Some other way to accomplish this (ideally without a plugin)

    I did find some articles on creating custom RSS feeds, but I’m not sure how to include a filter in the template that only displays English posts in the feed.
    https://www.wpbeginner.com/wp-tutorials/how-to-create-custom-rss-feeds-in-wordpress/
    https://www.wpmayor.com/how-to-create-custom-rss-feeds-wordpress/

    Does anyone know how to do this? Thanks in advance for any suggestions!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter acann

    (@acann)

    Can anyone help with this?

    Vuk Vukovic

    (@vukvukovich)

    Hi,

    That’s not supposed to be WPML behaviour.
    I would say that this is theme related issue.

    What theme are you using?
    Can you try it with “Twenty sixteen” theme?

    Cheers

    Thread Starter acann

    (@acann)

    WPML advised that this is expected behaviour. The theme is not related to the RSS feed, and it is fully compatible with WPML. The default RSS feed in wordpress always contains all posts. What I need is to do is either

    A) Alter the main feed so that it EXCLUDES posts marked by WPML as French (fr-FR)
    B) Create a custom RSS feed which only displays posts marked by WPML as English (en-US)
    C) Some other way to accomplish this (ideally without a plugin)

    Vuk Vukovic

    (@vukvukovich)

    Can you tell me what is the outcome if you change to “Twenty sixteen” theme?

    Does it show the same?

    Thread Starter acann

    (@acann)

    This isn’t live yet, so I haven’t tested anything. I need to figure out how to do this before I add the second language to the website otherwise it will cause issues with the auto-responder email campaign. I can create a french campaign driven from the https://mydomain.com/fr/feed rss feed, but my existing (english) campaign which is driven from https://mydomain.com/feed/rss will include by default all languages unless I customize it to filter out the french language posts, or create a custom RSS feed which only contains english language posts.

    What would changing the theme do? This has nothing to do with the theme, it has to do with the WordPress rss feed including all posts by default into the rss feed. Am I missing something?

    Vuk Vukovic

    (@vukvukovich)

    Theme changing will help us debug the problem and see if it is theme related.

    Thread Starter acann

    (@acann)

    But…there is no problem, nothing is broken right? Are you saying that wordpress is supposed to be automatically filtering all non-english posts out of the default RSS feed when WPML is configured as I’ve indicated? That is not how WPML explained it, they said wordpress includes all posts (regardless of language) in the main https://mydomain.com/feed RSS feed.

    I understand changing the theme when something is broken, but that isn’t the case here. This is a case of needing to customize an RSS feed to do something it doesn’t do by default.

    Vuk Vukovic

    (@vukvukovich)

    I have tried on fresh installation and example.com/feed/ is showing posts from that language (English in this case), while example.com/es/feed/ is showing Spanish posts.

    That is expected usage right?

    Thread Starter acann

    (@acann)

    Okay, so the Spanish posts are NOT showing up in example.com/feed is that what you’re saying?

    If that is the case, then I don’t have to do anything and that is fantastic! If that is what you’re saying (can you confirm) then I will proceed with the language changes to the site and once I’ve confirmed it is working I will come back and mark this as resolved. Thanks Vuk, sorry for the confusion on this.

    Vuk Vukovic

    (@vukvukovich)

    Exactly. You can check it out in action here:

    https://testing.wook.ml/feed
    https://testing.wook.ml/sr/feed

    Cheers!

    Thread Starter acann

    (@acann)

    You are correct Vuk!

    I have been able to confirm that the default RSS feed in wordpress at mydomain.com/feed/rss will only include posts from the WPML “default” language. Posts from alternate languages are excluded automatically.

    I’m not sure how or why this works since WPML themselves were unaware it would work like this, but it does.

    Closing ticket as resolved. Thanks again Vuk!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Custom RSS Feed for default WPML language’ is closed to new replies.