Support

Account

Home Forums General Issues Sort posts in a widget using 2 ACFs Reply To: Sort posts in a widget using 2 ACFs

  • Some issues with your current code.

    ACF does not store date fields in the DB as dates. It saves strings that are in the format of ‘Ymd’, so using a type of “DATE” will produce errors.

    If you want to sort by the second field then that field must have a value in the DB (even if that value is an empty string). WP will ignore any posts that do not have a value set for a field. I’m not sure what you mean by optional, but in this case the field would always need to be visible and allow no input.