Customizing custom post type messages

By default, WordPress uses messages of normal posts for the custom post types. We need to provide our own custom messages to improve the user experience. Customization of messages can be done with the existing filter called post_updated_messages. First, we have to update the constructor of the WPWAF_Model_Topic class with the following filter hook:

    add_filter('post_updated_messages',      array($this,'generate_topic_messages')); 

This filter enables us to add new messages to the existing messages array, as well as alternating the existing messages to suit our requirements. This is another section with duplicate codes, and hence, we will be using a common function to display the messages for all post types. ...

Get Wordpress Web Application Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.