3

I'd like to change the heading text on an edit page—this bit:

wp admin screenshot

I'm currently targeting it with jQuery (.wrap h2:first-of-type) and rewriting it that way, but it's not totally elegant - there's a bit of a flash when the page first loads that I'd like to avoid.

I know I could register a custom post type and set those titles manually (the labels attribute), but I'd only like it to change when certain conditions are met, and I'd like to change it to use information saved elsewhere in the site.

I'd like to avoid output buffering as well.

From what I can tell, core is just echoing $post_type_object->labels->name - is there any way to filter that output? I can't find anything, but I may be looking in the wrong places.

Thanks!

1 Answer 1

4

Found it! The post_type_labels_{$post_type} filter does the job beautifully.

(Documented here.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.