• Phil

    (@owendevelopment)


    Hi,

    My MySQL knowledge of queries suck, but I’m trying to query the DB to pull in the names of the custom fields associated with my custom post type.

    My code below does query and return a list but whats returned is ‘meta_key’ and it’s values are the names of the custom fields, BUT I need the returned as the name of the custom fields themselves, NOT ‘meta_key’ and a list of the field names.

    I can get allthis from PHP, but I have a plugin which only utilises MySQL queries.

    SELECT * FROM wp_posts
    INNER JOIN wp_postmeta
    ON wp_posts.ID = wp_postmeta.post_id
    WHERE 1=1
    AND wp_posts.post_type = 'test_posttype'

    …tried lots of combinations, but not the best at MySQL queries…

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Fetch custom field keys (names) using MySQL’ is closed to new replies.