#38487 closed enhancement (fixed)
the_archive_description() doesn't output the custom post type description when used in a post type archive template
Reported by: | henry.wright | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.6.1 |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | template | Cc: |
Description
When registering a custom post type using register_post_type()
, we can provide a CPT description using the description
param.
If the_archive_description()
is used in a custom post type archive template, the CPT description doesn't get outputted.
Attachments (1)
Change History (14)
#3
@
8 years ago
@swb1192 the_archive_description()
has a filter that you can use to display the post type description yourself.
#4
@
8 years ago
Further to @swissspidy's post above, you may need is_post_type_archive()
if your filter function is in a plugin or in your functions file.
Ref https://codex.wordpress.org/Function_Reference/is_post_type_archive
#5
@
8 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
#6
@
8 years ago
- Keywords has-patch added; needs-patch removed
38487.diff will output the custom post description in custom post archives.
#9
@
7 years ago
- Owner set to DrewAPicture
- Resolution set to fixed
- Status changed from new to closed
In 40976:
#11
follow-up:
↓ 12
@
7 years ago
Hey @DrewAPicture
In the commit, if post_type_obj->description
isn't set, $description
doesn't get set. Does that matter?
#12
in reply to:
↑ 11
@
7 years ago
Replying to henry.wright:
Hey @DrewAPicture
In the commit, if
post_type_obj->description
isn't set,$description
doesn't get set. Does that matter?
It does matter, yes :-) I removed the initialization thinking that I'd left the fallback from your original patch in there, but I didn't. Good catch.
Related: #37535