WordPress.org

Ready to get started?Download WordPress

Forums

get_posts doesn't return posts with 3 digit custom field value (1 post)

  1. kreso777
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic