WordPress database error (2 posts)

  1. moonswolf
    Posted 9 years ago #

    Hi guys, i'm new on this forum.
    I'm writing a plugin for change the order of every post inside a directory with a simple interface.

    Now, i've finished the plugin, but when i go in a category, i've this error message:

    WordPress database error: [Column: 'ID' in field list is ambiguous]
    SELECT COUNT(DISTINCT ID) FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND (category_id = 3) AND post_date_gmt <= '2006-10-05 12:09:59' AND (post_status = "publish" OR post_author = 1 AND post_status != 'draft' AND post_status != 'static') AND post_status != "attachment"

    This is a query that i've not found on wordpress files, and is not a query made by me..what does is it? how could i resolve my problem?
    Although this problem my plugin works very fine!

  2. moonswolf
    Posted 9 years ago #

    I've created a new field on wp_posts table, this fiel is "post_ordine".
    After this i've modified, in the classes.php file,the variable "$allowed_keys" where i've inserted the name "ordine" as allowed key. So in index.php i could sort my post using "orderby="ordine" is it right? :(

    The mistake is on the field that i've created..but i don't know why!
    helpme! :(

Topic Closed

This topic has been closed to new replies.

About this Topic