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']
    – birgire
    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.
    – Picard102
    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/…
    – Rup
    Commented Jun 21, 2023 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.