Why query by specific date with variables doesn’t return same result that with harcoded integers?

I believe your problem is that you are not casting the variables over into integers. You should give this a try: $query->set(‘date_query’, array( array( ‘year’ => (int)$dies[‘year’], ‘month’ => (int)$dies[‘mon’], ‘day’ => (int)$dies[‘mday’], ), )); or if you would like, before you even set up the arguments for the query, you could do something along … Read more

Child pages not affected by orderby

post_parent should be the ID of the post parent, not the slug. Apart from that, your code should work. If not, look for any posts_* filters or pre_get_posts actions that might influence your custom query EDIT Something else I have missed, $args is already an array, so you do not need to add it another … Read more

CPT Archive pre_get_posts not working?

&& is_post_type_archive(‘local-attractions’) is_post_type_archive isn’t set yet, WP is still deciding this, hence the call to pre _get_posts. Instead use: && $query->is_post_type_archive(‘local-attractions’) The same is true of any other is_ type methods, use the $query object, else you might be asking these questions about a completely different query and getting confusing results

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)