WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Iam using an external file (feed_home.php) wich is loaded with AJAX onclick.

    $("#new a").click(function(){

        var post_id = $(this).attr("rel")
        return false;


has the following code to load the amazon rss feed:

include_once(ABSPATH . WPINC . '/rss.php');
$feed = 'http://www.amazon.de/rss/new-releases/videogames/';
$rss = fetch_feed($feed); ?><?php 
if (!is_wp_error( $rss ) ) :
    $maxitems = $rss->get_item_quantity(3);
    $rss_items = $rss->get_items(0, $maxitems);
    if ($rss_items):
        echo "<ul>\n";
        foreach ( $rss_items as $item ) :
            echo '<li>';
            echo '<a href="' . $item->get_permalink() . '">' . $item->get_title() . "</a>\n";
            echo '<p>' . $item->get_description() . "</li>\n";
        echo "</ul>\n";

The problem is, that I'm always getting this error:

include(stream.php) [function.include]: 
failed to open stream: No such file or directory in 
/is/htdocs/...mywebsite/feed_home.php on line 2

Without the Ajax, the Amazon Rss Feed appears. Any idea? Thank you!


Well, I think, I am getting slowly what this means:

But I have no clue how to handle this.

the "feed_home.php" has to have something like a minimal Wordpress surrounding, right?

Has it something to do with

// Stop most of WordPress from being loaded if we just want the basics.
    return false;

But how can I get it work?

Thank you!


share|improve this question

Your stand-alone file doesn’t know the WordPress constants and functions. Use the native WordPress AJAX API instead.

See also: What's the preferred method of writing AJAX-enabled plugins?

In short: Put all your custom code into a function or a class and hook from your plugin into …

add_action('wp_ajax_ACTION_NAME', 'your_function');

… and …

add_action('wp_ajax_nopriv_ACTION_NAME', 'your_function');

Replace ACTION_NAME with something very unique.

share|improve this answer
Hi Toscho - thank you for the reply. I think I could need a bit more help. I understand, that the stand-alone file is not working, because all the needed stuff is missing, but I am not sure what to exactly do - even after visiting your links - to integrate this stuff. Would be superb if you could give me another hint. Thank you! – ad2003 Jul 18 '12 at 12:44
I don’t know where you got stuck. :) Read through the highest voted AJAX questions, there are many good, working examples. – toscho Jul 18 '12 at 13:01
thanks - I add some code I tried to my question - it's kind of wrong - I am sure. But I really don't understand, where to put the stuff....thx – ad2003 Jul 18 '12 at 17:21
Could someone give me a little bit more specific hint? thank you! – ad2003 Jul 19 '12 at 16:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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