WordPress.org

Support

Support » How-To and Troubleshooting » get_pages() object selection problem using multiple Custom Fields

get_pages() object selection problem using multiple Custom Fields

  • 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Just use get_post_meta().

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_pages() object selection problem using multiple Custom Fields’ is closed to new replies.
Skip to toolbar