Maybe someone can help to make related posts with custom posts type? I am stuck with that... Code is here: https://pastebin.com/zRVjuMBn

For example:

We are in current post:

ID | title | cust_category | cust_names | cust_settings

1 | X1 | cat1, cat3 | name8 | set1, set5

And we have customs posts:

ID | title | cust_category | cust_names | cust_settings

2 | X4 | cat1 | name9 | set2

3 | X1 | cat1, cat3 | name9 | set5

4 | X8 | cat12 | name12 | set12

So related posts to current post (ID = 1) will be:

ID 3 and ID 2.

  • ID3 is the most related, because it has the same values - X1, cat1, set5 (related 3 values).

  • ID 2 is also related by one value - cat1.

Or you can see this explanation in image:

enter image description here

1 Answer 1


P.S. In this project I use ONLY the same custom post type. No simple posts and other. Just "custom_post_name" customs posts. Nothing else. I am trying to make it work about few weeks. Please help me. As I understand I need only a good query and that is it. I am very beginner in WP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.