August 2017
Beginner
412 pages
10h 30m
English
Whenever a user updates, previews, or does anything with a book, you'll want them to see an accurate message. All we need to do is create an array of messages and then hook them to WordPress. Here's the code for doing that:
function book_updated_messages( $messages ) {
$messages['book'] = array(
'', /* Unused. Messages start at index 1. */
sprintf('Book updated. <a href="%s">View book</a>', esc_url(get_permalink($post_ID))),
'Custom field updated.',
'Custom field deleted.',
'Book updated.',
(isset($_GET['revision']) ? sprintf('Book restored to revision from %s', wp_post_revision_title((int)$_GET['revision'], false)) : false),
print('Book published. <a href="%s">View book</a>', esc_url(get_permalink($post_ID))), 'Book saved.', ...Read now
Unlock full access