Display all posts starting with given letter?

Don’t use post types, use taxonomy terms!

On save, set the object terms in an A-Z taxonomy, using the first letter of the post title. Make sure to force upper or lowercase for consistency. Make sure to create terms for each letter of the alphabet, and a term for numbers and other non alphanumeric symbols.

This should be faster than querying the first letter of each post title, and it gives you a taxonomy you can do more stuff with, like tag clouds, or term lister widgets! It’s also a much faster way of determining which letters have associated posts and how many, without forcing the database to manually count, and you can use standard WordPress term APIs out of the box to do more complex queries, like posts starting with vowels

Leave a Comment