[wp-trac] [WordPress Trac] #50375: Using post_type_archive_title() does not return the right laebl
WordPress Trac
noreply at wordpress.org
Tue Apr 4 08:58:21 UTC 2023
#50375: Using post_type_archive_title() does not return the right laebl
-----------------------------+------------------------------
Reporter: shamai | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.4.2
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by mayur8991):
{{{
$post_type_obj = get_post_type_object( get_post_type() );
$title = apply_filters('post_type_archive_title',
$post_type_obj->labels->name );
}}}
Use it the way i mentioned
post_type_obj contain all details you can retrieve the data you need.
it contain many things like label , name , archives etc
{{{
WP_Post_Type Object
(
[name] => post
[label] => Posts
[labels] => stdClass Object
(
[name] => Posts
[singular_name] => Post
[all_items] => All Posts
[archives] => Post Archives
[menu_name] => Posts
[name_admin_bar] => Post
)
)
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50375#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list