The loop suddenly stopped working?

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 10 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12170

    Out of nowhere I can no longer view the events in my loop. The events are all set to take place in the future and are single occurrence events. When I tried to create a new event, it showed up in the loop correctly. The loop was working correctly on Fri.

    WP_Debug doesnt seem to return anything pertinent.

    Can you help me debug this? I’m unsure of what could be causing it. This is my loop:

     $day1_q = new WP_Query('post_type=event&ondate=2014-09-14');
    Gabriel David
    #12181

    I’m noticing on the Events section in the backend the start/end date/time are now showing blank on the table. It seems like they either reset and/or are no longer pulling correctly for some.

    Gabriel David
    #12185

    The only way I can get the ones that show up as blank to show the correct date on the admin screen is if I totally change it to something else than change it back :/

    This seems a bit unoptimal to me in the case of weird behavior like this. Would make more sense if on save_post event it always tried to update the date. I’m assuming ur code looks something like this below pseudo-code

    on(‘save_post’) ->
    if($new_date != $cur_date) ->
    change date

    whereas I would think that not having that conditional would be optimal so I can just hit update and it would remedy itself.

    Gabriel David
    #12190

    Hi Gabriel,

    Event details are updated on each save_post. However, the existing event schedule is compared with the ‘new’ one to see if dates need to be updated/changed. This is because dates would be deleted and replaced wholesale (which would have obvious negative repercussions when an event has a booking, tied to the occurrence ID, and that occurrence ID vanishes).

    A recent update means existing dates are compared with the ‘generated’ ones to see if events need to be updated/removed/added, which renders this less important. So the above checks will be removed once it’s been established that it’s no longer needed.

    Re-updating events only addresses the symptoms though – and I’d like to establish the root cause and provide a fix (if appropriate). Are there any indications as to what might be cause this odd behaviour? Since updating events fixes the issue, it seems the problem is less in the source code (of any plug-in) but in the integrity of the database. Do you know of any reason why this might happen?

    If you still have events exhibiting this problem, I’d be happy to take a look at the database if you are able to provide me access (or SQL dumps, along with the IDs of the affected events).

    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.