$field['event_start_date'] is created using min(wp_postmeta.meta_value)

Home Forums Calendar Products Events Calendar PRO $field['event_start_date'] is created using min(wp_postmeta.meta_value)

  • This topic has 3 replies, 2 voices, and was last updated 9 years ago by Natasha.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1263586
    Natasha
    Participant

    For some reason, which I am trying to discover, the posts_fields function defines event_start_date by getting the lowest meta_value from all returned with a post.

    I’m using pre_get_posts to filter out a few categories, but I’d like to also use a meta_query, which breaks the main query because in the fields returned the ‘start date’ is not always the meta field with the smallest value. I’m occasionally getting values from ‘_EventDuration’, ‘_EventVenueID’, or ‘_EventOrganizerID’.

    What is the logic behind using the min meta_value as opposed to the actual custom field ‘_EventStartDate’?

    #1263590
    Natasha
    Participant

    Looks like my meta query was overriding the meta query where the key to use was being set. I’ve added

    'relation' => 'AND',
    			array(
    					'key' => '_EventStartDateUTC'
    			),

    to the top of my meta query and it looks like we’re back in action.

    #1264004
    Geoff
    Member

    Excellent work! I’m so glad to hear everything is working smoothly and I appreciate you following up to let us know. Definitely keep us posted if any other questions come up and we’d be happy to help. 🙂

    Cheers and have a great day!

    Geoff

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘$field['event_start_date'] is created using min(wp_postmeta.meta_value)’ is closed to new replies.