Let’s explore the most prominent features of the custom query parameters.
Getting the posts ID
Step 1 – Navigate to the WP Dashboard and find the posts which ID you want to know.
Step 3 – Hover the title of the necessary post.
Step 4 – While hovering at the bottom of the screen you will see a line with a number near the word ‘post=’. It is your ID. Copy it to the clipboard or just keep it in a mind for a while.
Setting the Posts Query: the post parameters
Step 1 – Proceed to the Content > Post Query tab and select in the dropdown menu the first option that is called Posts Parameters.
Step 2 – Next, in the option Include posts by IDs, you can add the particular posts to be displayed. If you want to query more than one post ID, you can enter more IDs in the corresponding fields, separating them with the comma.
If you want to display the related posts (either parent, or child one) you should put in the Include posts by IDs field the appropriate macros %related_children_from|post-type-slug% or %related_parents_from|post-type-slug%.
Step 3 – The same you can perform with the Exclude posts option.
Step 4 – Up to your needs, you might have created the child posts to the parent one in the same post type. To display them you should enter in the Get child of field the ID of the main (parent) post and all child posts from the same post type will appear.
Step 5 – In the Posts Query tab don’t forget to select the Publish option in the dropdown to display them. Or, you are able to choose any other status to require your needs to showcase posts with the special status only.
In this post, I showed you how to use the post parameters to query the posts.