• Resolved adkink

    (@adkink)


    Hello, I would like to know if it is possible that the “Custom Posts” created with “Pods Plugin” are displayed in Categories, Tags, Files, etc.

    Basically, I want to add my new post type to WordPress category and tag archives.

    For example, if I have a custom post called “Movies” with the category “Horror” and also have a custom post called “Books” and the category “Horror”, it is possible that when you click on the Horror category, all the contents of horror are shown?

    Currently, if I click on Horror I only see the posts created in the original “Post” tab of WordPress.

    Just as an example, in “Custom Post Types UI Plugin” they have this solution:
    https://docs.pluginize.com/article/17-post-types-in-category-tag-archives

    Do you have some similar solution?

    Thanks for your time in advance.
    Kind regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jim True

    (@jimtrue)

    That is actually the exact same solution. WordPress Core specifically limits Category and Tag Archives (and widgets, etc.) to only be displayed for the ‘post’ post-type. The only way around this is to add other post-types to the pre_get_posts filter which is what that linked code is doing.

    This line specifically:

    
    // Replace these slugs with the post types you want to include.
    		$cptui_post_types = array( 'my_post_type', 'my_other_post_type' );
    

    Is used to create an array of post types that you want to be added to the pre_get_post filter for Categories and Tags. In your case, you’d change it to:

    
    // Replace these slugs with the post types you want to include.
    		$cptui_post_types = array( 'movies', 'books' );
    

    Hope that’s helpful!
    Jim

    Hi Jim,

    Thanks for answering. I have the exact same issue.
    I’m no expert coder. Could you please let me know where I should put these lines?
    Which file?
    Thank you 🙂
    Guillaume

    Plugin Author Jim True

    (@jimtrue)

    You don’t have to be an expert coder; these go in the functions.php file of your child theme.

    If you’re very uncomfortable with coding, this plugin should do what you need:
    https://wordpress.org/plugins/custom-post-type-taxonomy-archives/

    Thank you very much Jim. I will try this 🙂

    Works perfectly. Thank you!

    Plugin Author Jim True

    (@jimtrue)

    Glad to hear it.

    Thread Starter adkink

    (@adkink)

    Thanks for your answers @jimtrue

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add my new post type to WordPress category and tag archives’ is closed to new replies.