I am using fetch_feed and basically have the same code as the great example provided here but I am creating new posts from the content instead of displaying it afterwards. The errors I am seeing are:

Warning: include_once(ABSPATHWPINC/feed.php) [function.include-once]: failed to open stream: No such file or directory in /home/user/public_html/test/wp-content/plugins/rss-plugin/rss-plugin-scan.php on line 6

Warning: include_once() [function.include]: Failed opening 'ABSPATHWPINC/feed.php' for inclusion (include_path='.:/opt/php53/lib/php') in /home/user/public_html/test/wp-content/plugins/rss-plugin/rss-plugin-scan.php on line 6

Fatal error: Call to undefined function fetch_feed() in /home/user/public_html/test/wp-content/plugins/rss-plugin/rss-plugin-scan.php on line 9

Line 6 is the first statement:

include_once( ABSPATH . WPINC . '/feed.php' );

and line 9 (the second statement) from my scan file is:

$rss = fetch_feed( 'http://www.website.com/rss' );

I have been digging around but the few posts I found that were similar on wordpress.org were not resolved or never answered. One fix I see when searching is to make sure there is no wp_error but I am already using the code from the codex example which includes this.

if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly

I am loading the rss-plugin-scan.php file using this method:

$plugin_location = plugins_url();
$scan_url = $plugin_location . '/rss-plugin/rss-plugin-scan.php';

<a href="<?php echo $scan_url ?>?scan=true&source=<?php echo $feed_source;?>"><b>Scan Now!</b></a>

Is there any reason why this would work perfectly within my index page every time I reloaded it but not within this plugin/wp-admin?

1 Answer 1


The error suggests the problem-- ABSPATH and WPINC are not defined. That is why you are seeing ABSPATHWPINC/feed.php in the error. PHP is trying to make the most of the undefined constants and is treating them like strings. It is easy enough to demonstrate this by echoing a string like IAM.NOT.'defined'.

This is likely because you are loading rss-plugin-scan.php directly which means the WordPress core isn't loading to define those constants. You should be loading that file in a way that also loads the WordPress core, or the parts that you need..

I don't know how your plugin works, or what it ultimately needs to do, but you may want to load that file over the AJAX API, or by doing something like @Rarst explains here.

  • This is definitely on the right track. I have now added the code that @Rarst provided but I get the following Fatal Error still: Fatal error: Call to undefined function wp_remote_request() in /home/user/public_html/wp-includes/class-feed.php on line 77
    – Sean
    Commented Jun 20, 2013 at 3:33
  • The problem with doing what Rarst suggests is that you really have to know what you are doing (which I am sure Rarst does) in order to load all the things you need. Unless you really need the perfomance, I'd go with the AJAX API.
    – s_ha_dum
    Commented Jun 20, 2013 at 12:33

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.