0

I keep getting this error Call to a member function modify() on boolean with this code

$date_value = the_sub_field( 'date_string' );
$date = DateTime::createFromFormat('d/m/Y', $date_value);
$date->modify('+1 day');  

The last line gives me an error. Both of my formats (display and return inside of ACF) are the same 'd/m/Y'

Really frustrating stuff!

1 Answer 1

0

the_sub_field() echoes out the sub field. Use get_sub_field() instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.