WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type w/out single page (4 posts)

  1. jwind
    Member
    Posted 8 months ago #

    I've been working with an SEO individual that is bothered by the "extra work" registering a custom post type generates. I am not a SEO professional and make no claims here.

    That being said, there are quite a few instances where the archive/single pages are at the very least not needed and or generate duplicate content. no?

    Take for instance the following example. Lets say I register a CPT for FAQs. I then create a 'FAQ Page' where I query the FAQs and output - perhaps paginate etc etc... You may argue that it's nice to have a .single.php for each FAQ so the user could life a permalink to send to a friend or whatever. However, it's not NEEDED. I'm sure there are probably more complicated examples that are more irksome to an SEO professional.

    i've poked around a but and I don't see and can not find a simple way to register a CPT without single/archive page(s).

  2. catacaustic
    Member
    Posted 8 months ago #

    It's very easy to do. I've done this before for FAQ's, portfolios, etc. It's all in the arguments that you pass in. The way that I've done this is to set up the CPT as private, non-public, and then create a shortcode or template that fetches the CPT records and loops thorugh then.

    As an example, the arguments that I've used in the past are something like this:

    $args = array(
        "labels" => $labels,
        "public" => false,
        "publicly_queryable" => false,
        "show_ui" => true,
        "rewrite" => false,
        "capability_type" => "post",
        "hierarchical" => false,
        "menu_position" => null,
        "supports" => array ("title", "editor", "thumbnail")
    );

    The parts that are important are the public settings. Thats what makes sure that this CPT doesn't have any publicly viewable elements or pages, and can only be found/displayed by some internal process.

  3. jwind
    Member
    Posted 8 months ago #

    Why wouldn't you do: "public" => false, "publicly_queryable" => true,

    That would allow you to query and output as needed AND not have single pages?

  4. catacaustic
    Member
    Posted 8 months ago #

    Because I want to ensure that nothing is public unless I want it to be. So I use a shortcode to output the details so that I can use them on which ever page I want them to be on. That way I control everything about that content type.

Reply

You must log in to post.

About this Topic