WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Single CPT doesn't load single template

[Resolved] Single CPT doesn't load single template

  • I’ve been making theme’s using custom post types for a while, but for some reason the current theme isn’t loading the single-cpt.php for a single cpt post.

    How does WordPress recognize that the current object is a single post?

    I made a custom rewrite rule, bases on a meta_key and meta_value. Is that the problem and should it contain an ID/slug/etc?

    index.php?post_type=book&meta_key=book_isbn&meta_value=$matches[1]

    Apperently, WordPress isn’t able to find out that it’s a single post. How can I still use this query vars, but use the single-book.php template?

Viewing 1 replies (of 1 total)
  • I found the sollution, I had to hook template_redirect to include the single template based on the query vars.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Single CPT doesn't load single template’ is closed to new replies.
Skip to toolbar