Closed alexstandiford closed 4 years ago
Perhaps the date query needs to extend the base, or regular query, or otherwise.
You are correct that value should be inherited, set once and then interacted with at that single point.
See, that's the weird part. Date
does extend Base
. I just tested this again and it worked as-expected. I just wish I could replicate exactly what I was doing to cause this, because I know that this happened to me at some point.
I haven't seen this happen yet.
The logic surrounding the WPDB
integration is intentionally loose, so my guess is this was just an inheritance/implementation issue.
I think it's OK to close this, and we can reopen if it comes back.
If I run a query without a date query, everything works as-expected. However, if I include a date query,
get_db()
returns false.This appears to be because the date query object is a separate type of query, and it expects that it should also have a
$db_global
variable set.As a hotfix, I currently have hard-coded this in my Date_Query object, and it appears to be fixing the problem:
Obviously this isn't ideal, but I'm really not sure how else this can be resolved. Shouldn't the date query object inherit the db global from the query it's running within?