• hi everybody,
    i’m trying to recreate the menus with a mysql request,
    but i don’t get what’s the relation for some items,
    i’m using : wp_terms, wp_term_taxonomy, wp_terme_relationships, and wp_post
    though i can some items like category, custom links,…

    I can’t see the relation with pages in the tables… for example, none of the page have an id which match in the wp_term_relationships table;

    anyone to help me understand what’s the relation ?

    thx,

    David

Viewing 1 replies (of 1 total)
  • Thread Starter David Fieffé

    (@moabi)

    i need this because i’m merging wordpress with another CMS,
    so right now,
    i came with :

    SELECT a.*,b.*,c.*,d.*
            FROM  <code>wp_posts</code> a
            LEFT JOIN <code>wp_term_relationships</code> b ON ( a.ID = b.object_id)
            LEFT JOIN <code>wp_term_taxonomy</code> c ON ( b.term_taxonomy_id = c.term_taxonomy_id )
            LEFT JOIN <code>wp_terms</code> d ON (c.term_id = d.term_id )
            WHERE post_status = "publish"
            AND d.name = "main_menu"

    this is ok as it retrieves the menu except it doesn’t get the pages which are included in it in wordpress…don’t know why, i have to change the name of the page so it appears in the menu…
    any idea ?
    NB: don’t mind the syntax (weird, but it’s the way it is…!)

    THANKS

Viewing 1 replies (of 1 total)

The topic ‘retrieve menu with mysql’ is closed to new replies.