Hi,
I have this issue on my $arg code where meta_key does not display if there is no value (empty) . My question is how do I display data even if my custom field is empty. Can anyone help me on this?
$args = array(
'post_type' => 'property',
'meta_key' => 'property_price',
'orderby' => 'meta_value_num',
'order' => 'DESC',
'posts_per_page' => 10,
'paged' => $paged
);
thanks
Just wondering, if the field is empty, what would you need to list?
The current situation is a property won’t list if “price” field is empty. What I want to achieve is display property both empty or not.
I think what you’re trying is to display the property with highest price in the order and also display property with no price as well, right?
$args = array(
'post_type' => 'property'
'posts_per_page' => 10,
'paged' => $paged,
'orderby' => 'meta_value_num',
'order' => 'desc',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'property_price',
'value' => '0',
'compare' => '>=',
),
)
);
I think this could help. try it once
thanks but this still not working.