0

I create a custom post type name 'Blog' and Taxonomy is 'Category'. and i also create archive page 'archive-blog.php' to show all custom post. When i click 'mydomain.com/blog' show all custom post.

All the post have some category. But my question how i show my custom post by category

when i enter 'mydomain.com/blog/[my category name]', is not work. what is the valid url that show post only by category

2
  • Do you mean you have created custom category taxonomy or that you have applied native categories to your CPT?
    – Rarst
    Commented Jul 12, 2014 at 14:09
  • I applied native categories to my CPT Commented Jul 14, 2014 at 5:10

1 Answer 1

0

There is no concept natively of archive for intersection of specific custom post type with specific taxonomy.

There are multiple approaches here, but all will take some tinkering:

  • you can adjust category term archives to include your CPT (via pre_get_posts hook)
  • you can extend custom post type archives with endpoint to filter them by category
  • probably more ways, it gets pretty arbitrary outside of native functionality

In your specific case I find it a little strange that CPT in question is a "Blog", since that's what native posts already are (and likely easier to go with for, well, blog).

1
  • i think my question is not clear for all. I need to show category wise posts for custom post type in wordpress. I have tried a lot with the code, but yet no result. Is there any way to display posts category wise for custom post type in wp. Normal post can be show easy way by category or tags wise. But how i show in custom post type. Commented Jul 17, 2014 at 10:16

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.