• Resolved jazgold

    (@jazgold)


    hello,

    i have a separate page outside of my wordpress installation in which i decided to list the last 5 posts from my blog.

    i thought everything was working fine until i made a new blog entry, which didn’t show up at the top. here is the code that was supposed to list the last 5 posts:

    require('../blog/wp-blog-header.php');
    $args = array(
         'order' => 'DESC',
         'numberposts' => '5',
         'orderby' => 'post_date'
    );
    $posts = get_posts(args);

    instead i’m getting what i’m assuming is the default action – displaying 5 posts ordered alphabetically (which my former last 5 posts happened to be strangely).

    no matter what arguments i feed get_posts() it always gives me 5 alphabetically sorted posts. i tried the string format get_posts(‘numberposts=3’); even if i feed it gibberish. nothing changes the output.

    the only difference i can see is that i’m trying to do this from a php file that’s outside the wordpress folder, in fact it’s in a different subdomain on the same server.

    anyone got any clues? thanks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘external call to get_posts doesn’t recognize args’ is closed to new replies.