WordPress.org

Support

Support » How-To and Troubleshooting » get_posts doesn't return posts with 3 digit custom field value

get_posts doesn't return posts with 3 digit custom field value

  • This is sort of a followup question to an earlier one (resolved).

    In brief – i have custom field with values 1-100 for each post. When I try to list posts with highest values like below, posts with value 100 are missing from the list.

    So it returns posts with 99..90…50 all down to 20, like I’ve set here:
    meta_key=CUSTOM_VALUE&meta_compare=>&meta_value=20
    But not 100 :/

    Also, DESC order doesn’t work with this?

    Here is the whole code:

    <?php
    $myposts = get_posts('meta_key=CUSTOM_VALUE&meta_compare=>&meta_value=20&orderby=meta_value&ordrer=ASC');
    foreach($myposts as $post) :
        setup_postdata($post); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title();?></a> <?php echo get_post_meta($post->ID, 'CUSTOM_VALUE', true); ?></li>
    <?php endforeach; ?>

    Thanks in advance if anyone knows the solution.

  • The topic ‘get_posts doesn't return posts with 3 digit custom field value’ is closed to new replies.
Skip to toolbar