I checked inside the admin interface and confirmed that multiple categories were indeed set (checked off) for both of the above example events.
By using the following query in phpMyAdmin, however, I noticed that category_id is NULL for many events, but not for others:
SELECT e.*, ese.start_time, ese.end_time, p.event_cost , v.name venue_name, v.address venue_address, v.city venue_city, v.state venue_state, v.zip venue_zip, v.country venue_country, v.meta venue_meta, v.id venue_id FROM wp_events_detail e LEFT JOIN wp_events_start_end ese ON ese.event_id = e.id LEFT JOIN wp_events_prices p ON p.event_id=e.id LEFT JOIN wp_events_venue_rel vr ON vr.event_id = e.id LEFT JOIN wp_events_venue v ON v.id = vr.venue_id WHERE e.is_active = 'Y' AND (e.start_date >= '2014-11-18' OR e.event_status = 'O' OR e.registration_end >= '2014-11-18') AND e.event_status != 'D' AND e.event_status != 'S' GROUP BY e.id ORDER BY date(e.start_date), ese.start_time ASC
*** Is it possible that category_id is a new(er) field, which is why existing/old events do not have the categories listed in that field? I recently upgraded from 3.1.24.1.P all the way to 3.1.36.6.P.
Is there a query I can run to populate that field with the correct category ids?
Take a look at the wp_events_category_rel table and see if there are entries there which correspond to the categories assigned to one of the bad events. If the data is there, then you should be able to get it into the field in wp_events_details.
I apologize, I know it’s a violation of DB normalization, but it was probably done to maintain backwards compatibility in EE3’s long life.
The support post ‘wp_events_detail – Some events category_id is NULL when it shouldn't be’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.