Support

Account

Home Forums General Issues Salary – Find posts between and including value

Helping

Salary – Find posts between and including value

  • Hi all,

    I have created a job listings site which includes the ability to look for a job between a salary band. By default, max and in is set. So min is 0 and max is 100,000.

    When a user uses the slider and selects 20,000 – 30,000 it will find jobs that are set to 20,000 to 30,000. However, if a job is 20,000 – 35,000 this is ignored.

    Form my meta query, I am using the following:

    array(
    						'key'	  	=> 'salary_max',
    						'value'	  	=> $max,
    						'type'		=> 'NUMERIC',
    						'compare'	=> '<='	
    					)
    
    array(
    						'key'	  	=> 'salary_min',
    						'value'	  	=> $min,
    						'type'		=> 'NUMERIC',
    						'compare'	=> '>='
    					)

    Its not an OR query because I don’t want the results that are greater than min OR less than max.

    Any ideas?

  • I don’t see anything wrong with your code. If it’s working for other ranges are you sure you’re setting $min and $max to the right values for the 20-35k range?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.