Timeline for Custom WP_Query not returning results when querying custom post type
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 15, 2017 at 22:52 | history | edited | Celso Bessa | CC BY-SA 3.0 |
some code corrections
|
Nov 15, 2017 at 22:19 | comment | added | Celso Bessa | Just covering all bases: 1) How was the award post type created? 2) as pointed by Welcher, did you changed to $next_posts->the_post() ? | |
Nov 15, 2017 at 18:21 | comment | added | grazdev | I know the query for 'award' post types is NOT working because I have var_dumped it and it returns no results. Differently, it does work and it does return results if I set 'post' or 'page' as the post_type. Anyway, echoing $post->post_title doesn't work. As to the template part code, it includes a few classes (OOP) so it would be confusing to share it, but even if I take everything away and just echo a <p>Hello</p>, no new posts show up. | |
Nov 15, 2017 at 17:03 | comment | added | Celso Bessa | before going any further, please 1) test what I asked on my comment above : " test the same loop but without the get_template_part. Instead, using something like echo $post->post_title; ?" so we can check if the query is working 2) can you share your template part code? | |
Nov 15, 2017 at 16:22 | comment | added | grazdev | Just tried, but I get a 500 error. Plus, like I said in my question the AJAX call works if I change the post_type from 'award' to 'post' or 'page', so I guess there must be something wrong with the WP_Query, not with AJAX. | |
Nov 15, 2017 at 15:55 | history | answered | Celso Bessa | CC BY-SA 3.0 |