Site logo

Archived topic

Query Loop + Custom Post Type = No results found

6 replies · Started by Matthew on February 8, 2023

Viewing posts 1–7 of 7

I created two custom post types. Identical custom fields. Identical Elements to create the posts (two separate elements). And identical landing pages (two separate landing pages) to display all the custom posts for each. The only difference is the terminology and labeling. For example, one is for ebooks, and the other is for templates.

For templates build: The landing page and the element that use a query loop (the templates custom post being the data source) both show "No results found" when I click on the query loop block. And I can no longer edit anything within this block.

For ebooks build: Zero issues. The only difference is the query loop selects its custom post type for the data source.

Both templates and ebooks output as expected on the front end flawlessly.

What's wrong with the templates build? Why "No results found"?

Any quick recommendations? I have looked over the custom post types and the custom fields carefully. Can't see any difference between how I created the two.

Very simple custom post types with few custom fields.

Yes, both CPTs set to show in the REST API.

Hi there,

could it be the templates slug ? what if you name it something less generic ( my concern is that something in WP backend may also be using that ) eg. custom-templates

There were pages using the URLS /ebooks and /templates.

When I created the CPT slugs (ebooks and templates), I was not blocked from doing so.

When I tried to create the CPT slug webinars, I was prevented and told to choose a different slug (since /webinars existed as a page). So, I did. And that CPT and GeneratePress work fine.

So, yeah, maybe, the templates slug should be cm-templates or anything different to prevent the issue.

It's just weird that I wasn't blocked from using CPT slugs ebooks and templates when I created those CPTs given the pages existed. Perhaps those pages (/ebooks and /templates) were drafted at that moment. Not sure.

Yeah, that seemed to clear it up. Thank you.

Glad to hear that it is now working :)

This archived topic is closed to new replies.