• Resolved e dev

    (@efishinsea)


    This might be obvious, but I haven’t found it yet. Is it possible to create custom post types that do everything they do but prevent them from being viewable as single posts? I am using these for a directory type setting but only need/want the information to show up in that context rather than each on their own URL as well.

    …nevermind. Seems that setting Publicly Queryable to false does the trick.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I was going to recommend utilizing the template_redirect action hook and check if is_single('my-post-type') and redirect elsewhere from there.

    However if publicly queryable works without wrecking displaying the information needed in other views, awesome.

    Let us know if you need anything else.

    Thread Starter e dev

    (@efishinsea)

    Out of curiosity, how could setting publicly queryable to false change what is displayed when writing out the post content?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    My thought pattern for this is more in say a custom WP_Query request that you’re using to construct output with, vs what I’m interpreting “publicly_queryable” doing here which is giving a solo permalink to see a given post with a theme’s single.php template file rendering the result.

    Because my head says both are doing a query technically, in the code, but to what degree is that “publicly” word.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘prevent single view’ is closed to new replies.