Function in array as arguments for WP_Query
I suspect the problem is coming from $MyCustomField which you enter as such in: ‘terms’ => array( $MyCustomField ), The query consider it as only one value: ‘64,72’, a string. So try: $MyCustomFieldValues = array_map( ‘intval’, explode( ‘,’, $MyCustomField ) ); This will also ensure your values are integers. Then: ‘terms’ => $MyCustomFieldValues,