Is it possible to sort the post based on a custom field?

I have a custom field called “value_date” where I enter a date e.g 20/04/2017

<?php
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'value_date', true);
wp_reset_query();
?>

The idea is sort the upcoming dates first in the loop, is possible?

Read more here: Is it possible to sort the post based on a custom field?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: