WordPress.org

Forums

Meta query problem (1 post)

  1. GWKaplan
    Member
    Posted 1 year ago #

    I have this code:

    'meta_query' => array(
    	'relation' => 'AND',
     	           array(
    		        'key' => 'n_de_personas',
    		        'value' => $selection1,
    		        'compare' => '='
                       ),

    And it works fine getting from the database the posts whose value of the key matches the value of $selection1 variable. But I need it to work for the values that match $selection1 and bigger ones. So I modified the code to:

    'meta_query' => array(
    	'relation' => 'AND',
     	           array(
    		        'key' => 'n_de_personas',
    		        'value' => $selection1,
    		        'compare' => '>='
                       ),

    And it also works, but only from 0 to 9. When it compares over 10 it goes wrong. Please could anybody help?

Topic Closed

This topic has been closed to new replies.

About this Topic