WordPress.org

Ready to get started?Download WordPress

Forums

get_pages() object selection problem using multiple Custom Fields (3 posts)

  1. beanmg
    Member
    Posted 5 years ago #

    I have a Page based WordPress site.

    I am retrieving Pages using get_pages like this:

    $PageOptions =array('meta_key'=>'type','meta_value'=>'lead');
    $pages = get_pages($PageOptions);
    foreach ($pages as $page) {
    echo $page->post_content;
    }

    However this Page also has other key/value pairs like 'image' & '2008/08/pix.jpg' which does not appear in the get_pages object [i.e. not present in any way in dump_var($page)]. All I can get at are the pair I made the get_pages selection with.

    What do I need to do to get at two or more meta_key/meta_values in a Page (not a Post and not in The Loop)?

    Beano

  2. scribu
    Member
    Posted 5 years ago #

    Just use get_post_meta().

  3. krishan.rodrigo
    Member
    Posted 4 years ago #

    I have the same problem as beanmg.

    I am trying to retrieve pages that have a specific meta key and value. According to my data I have 3 of them but it only displays 2.

    I used get_post_custom to get rid of the problem but can be cumbersome when so many pages are involved!

    Anyway, this still remains an unsolved issue.

Topic Closed

This topic has been closed to new replies.

About this Topic