WordPress.org

Ready to get started?Download WordPress

Forums

My DB query is failing me, I need the draft ID. Suggestions appreciated. (1 post)

  1. clarke1866
    Member
    Posted 8 years ago #

    Here is the code that successfully returns post_title, but does not return ID. I could really use that ID number, what am I doing wrong?

    $drafts = @$wpdb->get_results("SELECT post_title FROM $wpdb->posts WHERE post_status = 'draft' ORDER BY ID ASC");
    foreach($drafts as $draft) {
    and then this echo'd appropriately:

    "post.php?action=edit&post=' . $draft->ID . '">' . $draft->post_title . '';
    }

    I can never remember how to post code excerpts here properly, so please ignore minor html mistakes as they are intentional (to fool these forums into showing something usefull). Ug. The most important thing is that $draft->id doesn't seem to work.

    Thanks for any help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags