Home › Forums › Front-end Issues › Filtering CPT with date picker custom field › Reply To: Filtering CPT with date picker custom field
before you use the format function on the $date variable, can you please debug it’s value like so:
<?php
echo '<pre>';
print_r( $date );
echo '</pre>';
die; ?>
Also, can you please debug the value of your date field like so:
<?php
echo '<pre>';
print_r( get_field('class_date') );
echo '</pre>';
die; ?>
It is most likely that the date value is not in the correct format to be converted into the date-time object as your code is expecting. This debugging will highlight the issue
Thanks
E
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.