Updating the page title to include custom post data using plugin filters
The last customization touch that can be put in place to support our book reviews custom post type is to add custom information about the posts in the title bar when displaying them. For example, we could add the author's name next to the book title.
You should have already followed the Adding Quick Edit fields for custom categories recipe to have a starting point for this recipe, and the resulting plugin should still be active on your development site. Alternatively, you can get the resulting code (
ch4/ch4-book-reviews/ch4-book-reviews-v11.php) from the book's GitHub page and rename the file
How to do it...
Follow these steps to learn how to use the
document_title_parts filter to alter the post title for book reviews:
- Navigate to the
ch4-book-reviewsfolder of the WordPress
pluginsdirectory of your development installation.
- Open the