I've got a query for any page of posts.

It return results with different custom publish type, and custom area value. Now I have added a chance to order the outcomes according to another custom area.

$loop = new WP_Query( array ( 'post_type' => 'new', 'orderby' => 'meta_value_num', 'meta_key' => 'over-length', 'meta_query' => array( array( 'key' => 'over-make', 'value' => 'Doral', 'compare' => 'LIKE') ) ) );

I have encounter a little of the problem. I am ordering the outcomes with a custom area known as 'over-length' however it appears when a publish does not have a value for 'over-length' it's excluded in the results.

I am wondering how could I change my code to ensure that it incorporated publish that do not possess a value for orderby.

Also just considered a workaround, although not sure how to get it done. I am utilizing a wordpress plugin known as "more fields" to produce my custom fields. Will it be simpler to see if the 'over-length' area is empty and hang it to ? if that's the case how do you start carrying this out.

Update

I have investigated the problem a little further. It appears when no value is offered to 'over-length' the custom area isn't put into wordpress_postmeta within the database. Basically provide a publish a over-length value go back and take away it's does actually range from the lead to my query because the area remain within the database. So how do i understand this custom area to become joined in to the database if it features a value or otherwise?

Regarding your last request - for the way to include a meta_key (custom area) on all posts even when it's left blank:

I frequently make use of the wordpress plugin Custom Fields Template with this type of factor. It's like the one you're using (more fields) but it offers a superior many options to experience using the fields, and more importantly with this situation, you are able to adjust hidden fields and default values. You are able to possibly set a default=' ' (space) to achieve the area placed if left blank. Or, with a little more work, customize the wordpress plugin code to place all of the fields to DB without checking for empty the values. Within the situation of CustomFieldsTemplate it should not be difficult to do it.