[wp-trac] [WordPress Trac] #59422: Custom Post Type name with hyphen does not with custom single post template

WordPress Trac noreply at wordpress.org
Fri Sep 22 10:51:22 UTC 2023


#59422: Custom Post Type name with hyphen does not with custom single post template
--------------------------+------------------------------
 Reporter:  htung         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:  6.3.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  template
--------------------------+------------------------------

Comment (by faisal03):

 @htung thanks for the details. I have used your code and the CPT post
 displayed for me using `single-annual-report.php`. See the screenshot
 above.

 Please make sure that you are passing `true` in `public`.


 {{{
 'public' => isset($postType->{'public'}) ? $postType->{'public'} : true,
 }}}


 If this is `false`, you will not see the post detail page even if you use
 `single-annual-report.php`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59422#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list