Home Forums General Issues Using Number in meta query


Using Number in meta query

  • My problem is, when I use number custom field and try to use it in the meta query it only recognizes the first number. This meta query I’m trying to display the top 5 of a ranking of peaple.

    My custom field is named ranking, and whenever I try to add a person with the number field “10” for example, the person is wrongly displayed. It’s only “reading” the first number of every post. I tested with 60 and above and were not displayed, but with the first number from 1 to 5 is displayed no matter the other digits.

    Any help?

    <?php $pessoasQuery = new WP_Query(array(
    					'post_type' => 'person',
    					'posts_per_page' => -1,
    					'meta_key' => 'ranking',
    					'orderby' => 'meta_value',
    					'order' => 'ASC',
    					'meta_query' => array(
    				        'key' => 'ranking',
    				        'compare' => '<',
    				        'value' => 6,
    				        'type' => 'num'
Viewing 1 post (of 1 total)

The topic ‘Using Number in meta query’ is closed to new replies.