• [ Moderator note: moved to Fixing WordPress. Please do not use Developing With WordPress for these topics. ]

    HI,
    I have a question, there is a way for create custom post without a page in frontend? I need a list of post only as data, I didn’t want to have a detail page for this kind os post (the same for taxonomy)

    many thanks
    Francesco

Viewing 2 replies - 1 through 2 (of 2 total)
  • Yes, simply don’t create a template for it.

    However a default frontpage will still exist for the custom-post (the single.php template), I think that you can remove the access of it by setting the ‘publicly_queryable’ parameter to false in the register function : https://codex.www.ads-software.com/Function_Reference/register_post_type#public

    • This reply was modified 7 years, 6 months ago by Nokaa.
    • This reply was modified 7 years, 6 months ago by Nokaa.
    • This reply was modified 7 years, 6 months ago by Nokaa.
    • This reply was modified 7 years, 6 months ago by Nokaa.
    Moderator bcworkz

    (@bcworkz)

    Nokaa is correct, set the ‘public’ argument to false. It’ll be like it does not exist on the site, but code can get, create, update, and delete posts as usual.

    FWIW though, not creating a template will not help. WP will find something to use for public posts of any type. If not single.php, it’ll try singular.php, and failing that, index.php. All themes are required to have index.php, so a public post will always be displayed on request somehow.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post not visible on frontend’ is closed to new replies.