Forums

[resolved] query post meta (3 posts)

  1. nemci7v
    Member
    Posted 1 year ago #

    I created a custom post meta in which I enter a topic name. For example if I have 2 posts about Apple's Ipad, I would enter "ipad" in the custom meta for each post. Then I can query related posts WHERE custom_meta = 'ipad'

    This is sort of like tags but works better for relating posts. Is there a short WP code I can use to query post titles where a custom meta equals something?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  3. nemci7v
    Member
    Posted 1 year ago #

    Ooh! I didn't know codex covered that. As reference for anyone trying to use a variable with your meta this works,

    query_posts('meta_value=' . $some_variable);

Topic Closed

This topic has been closed to new replies.

About this Topic