[wp-hackers] Getting post type object from singular label
trentmar at gmail.com
Wed Jan 19 21:45:28 UTC 2011
Use case is that the user can select a post type from a list of singular
labels, i.e., Post, Page, etc. That post type label could later be matched
to the actual custom type name.
Obviously the better way is to include the Value in the Option tags of the
drop-down list, but that requires changing some of my UI framework which I
wanted to avoid.
On Wed, Jan 19, 2011 at 2:26 PM, Andrew Nacin <wp at andrewnacin.com> wrote:
> On Wed, Jan 19, 2011 at 4:15 PM, Trent Martin <trentmar at gmail.com> wrote:
> > I'm trying to get a post type name from it's singular label using
> > get_post_types(), however the singular_label property was deprecated
> > (Tickets #13357 and #14619).
> > Is searching $wp_post_types->labels->singular_name the only way to do
> > now?
> Yes. I wouldn't try to fetch a post type object/name from it's label
> Curious as to the use case there. get_post_types() wasn't designed with
> in mind, as you can tell.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers