[solved] WordPress: How to check if the post-type dropdown in the Query Loop block is populated with data?

good day dear Friends - hello everyone Smile :slight_smile:

at the moment i am working on a new WordPress-project.

and currently i am facing one certain issue: How to check if the post-type dropdown in the Query Loop block is populated with data?

outline: for a little test i have to do some quick lookup - i need to know if a “Post-Tpye” is visible in the so called “Post Type” drop-down?

How to do this check the certain drop-down: - where to start.

see some background: - and probably this may help here - since it has to do with the same topic - at least somehow

Using Query Loop with Custom Post Type

How to check if the post-type dropdown in the Query Loop block is populated with data?

outline: for a little test i have to do some quick lookup - i need to know if a “Post-Tpye” is visible in the so called “Post Type” drop-down?

some musings and assumptions: (how to achive this)

well i have made up my mind - and i think - that it should be doable like so:

well the step - thy could be like so;

… therefore i go to the the Query Loop Block
Inherit Query → OFF and then i should check:
Is the “Post Type” dropdown visible?

Are the certain post tpye - in my case “Foo-bar” selectable?

Does there “Test-story” appear?

all i need to know and i need to check is:

can i , I see post type “Foo-bar” in the dropdown

Or otherwise

No, the dropdown doesn’t appear.

Then we’ll know exactly where to start.

see some background: Using Query Loop with Custom Post Type

Screenshot: Query Loop with CPT options

image.png.df4e2c74a32260010f54cbc24f37af20.png

The post-type dropdown in the Query Loop block is populated with data from the REST API endpoint:

and yes - lets take for example:

/wp-json/wp/v2/types

The question is: so how to make sure the public custom post type is in a drop down menu - well therefore i think its necessary that it is registered with show_in_rest as true for it to be included within that data.

again - the background is: How to check the Post Type in the query-loop block:

well i think that i was recommended to go like so!

see some assumptions:

a. well to correctly configure the post type in the WordPress Gutenberg editor using the Query Loop block: we must select the outer container block. The Query Loop consists of several nested blocks, and only the parent block contains the settings for post type, number of posts, categories, and sorting.

b. Here’s how to select the outer “Query Loop” block:
Use List View (Recommended):
here we can do the following - we can click the icon that looks like three horizontal lines in the top left corner of the editor (List View). In the tree structure, find “Query Loop” and click it. This is the most reliable way to select the parent block.

c. Use Breadcrumbs:
Click an element within the loop (e.g., the post title).
In the editor footer, click the block path (Breadcrumbs) and select “Query Loop.”

d. Why this is important:
If we have selected the outer block, the “Post Type” option will appear under “Query” in the right-hand settings sidebar. Here we can specify whether to use “Posts,” “Pages,” or custom content types.

…well - these are some more theoretical assumptions - Can you confirm them - is it possible to do so!?

Look forward to hear from you

greetings

:thinking: As a WordPress user myself, I would suggest you post this question in a WordPress forum. Wouldn’t that be more likely to get results that others in that community could also benefit from?

2 Likes

good day dear ArchieLinux, :grinning:

many thanks - good advice. Youre right. Ill do as adviced - and try to figure it out.

BTW: glad to see that you also use WordPress. :grinning_face:

1 Like

@otrott This is a great community here. But I’ve not seen WordPress as a focus of attention, so best to go where the crowd is. Best wishes!

1 Like

hi there - thank you so much. I am so happy to be here - and yes: i think that this is one of the friendliest Linux-Community :grinning_face:

and : of course - its really great to see some of you here - that also use WordPress.

have a great day.
greetings :star_struck:

good day dear Friends - hello everyone :star_struck::slight_smile:

update: thread is solved now​:star_struck::beach_with_umbrella::cool::

finally got there - see on the right side - the drop down with the menu of the Post-Types

thread is sovled - i am happy,. :confetti_ball: :star_struck:

greetings - and have a great day.

see the overview - with the much much needed view of the Post-Types in the drop down - on the left side.

image.png.c7b1ec2c8db478b5d0eb06b1403b8e96.png

see the original-posting below