• Hi, I’m using WP_Query to query the WPDB with the meta_query attribute as follows:

    $args = array(
    	'nopaging' => true,
    	'post_type' => 'my_post_type',
    	'orderby' => 'title',
    	'order' => 'ASC',
    	'meta_query' => array(
    		array(
    			'key' => $meta_key,
    			'value' => $meta_value,
    			'compare' => $meta_compare,
    			'type' => 'numeric'
    		)
    	)
    );

    My users are storing the meta_value in as a number in the format of 21,234 (with a comma). The type numeric does not work as it’s not registering as a number.

    Does anyone know of any filters that I can use to filter that meta_value out so the query will run successfully?

  • The topic ‘Use WP_Query and meta_query with type numeric’ is closed to new replies.