0

I am using fetch_feed to pull in an rss feed, however I'd like to get the feeds header and the status code in the results.

Is there a method to modify the results to include these two items(status code, headers)?

1 Answer 1

2

fetch_feed() returns a SimplePie object. From a quick glance at its source, it looks like you can use

$feed->status_code // on the public API $feed->data['headers'] // technically private 
3
  • 1
    ps: might also try these public methods $feed->status_code() and $feed->get_raw_data()['headers'] Commented Jun 21, 2023 at 12:26
  • It doesn't appear that status_code is accessible in wordpress' implementation of SimplePie. The headers one worked though. Commented Jun 21, 2023 at 15:34
  • birgire is right: in WordPress's one it should be a function ->status_code() github.com/WordPress/WordPress/blob/6.2.2/wp-includes/… Commented Jun 21, 2023 at 15:45

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.