WordPress.org

Ready to get started?Download WordPress

Forums

Fetch feed from multiple categories with permalinks (1 post)

  1. stacef
    Member
    Posted 4 years ago #

    Hi all,

    Hoping you can help me out with a solution for fetching feeds from multiple categories from a blog with permalinks.

    Here's the deal: previously had 15 different sites running on individual installs of regular WP 2.7 and the default link style. I set up feeds to share selected info between some of the sites using the old magpie rss and my call looked like:

    $rss = fetch_rss('http://'.$_SERVER[HTTP_HOST].'/mysite/?cat=20,21,30,31&feed=rss2');

    and it all worked just fine.

    Now: migrated everything successfully to MU 2.9.2 (I don't believe this to be a situation unique to MU) and changed to custom permalinks /%postname%/%post_id% along the way. The new feed protocol uses Simplepie but simply adjusting the call to

    $rss = fetch_feed('http://'.$_SERVER[HTTP_HOST].'/mysite/?cat=20,21,30,31&feed=rss2');

    produces errors
    Warning: strpos() expects parameter 1 to be string, array given in [class-simplepie.php]
    Warning: substr() expects parameter 1 to be string, array given in [class-simplepie.php]

    I can get a feed from a single category successfully using a call like

    $rss = fetch_feed('http://'.$_SERVER[HTTP_HOST].'/wpmu/mysite/category/athletics/feed');

    but can't figure out how to structure the url to get all the categories I want.

    I know I can make an array of all the urls that correspond to my needed categories and then just go through them that way but I thought I'd check to see if there might be a better way.

    Thanks for any thoughts or suggestions!

    Stace

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags