By making a call to the register_post_type function, the entire WordPress environment becomes aware of the existence of this new post type. This awareness includes the creation of a dedicated section to create and edit posts of this type and the ability to process web page requests for Book Reviews.
As mentioned at the beginning of this recipe, the function is quite simple to use and only requires two arguments:
register_post_type( $post_type, $args );
The first argument is a text string that indicates the name of the post type. Please note when choosing this name that it will be used as the default value for the permalinks of all items that use the new type, and that it should be unique enough to avoid potential conflicts with other plugins.
The second argument is an array of properties that specify the characteristics of the new post type and determine how this type will be edited.
In this specific example, the first element of the properties array is actually another array, which contains a number of labels. These labels indicate the text strings that should be displayed when managing items created under the new post type. For example, if we look at the screenshot before step 11, the message No Book Reviews found came directly from the definition of the not_found label in this array.
The second argument, named public, determines whether the post type's administration interface should be shown to manage it and if visitors should be able to view single items. Next is the menu_position member of the configuration array, indicating the desired position of the new element in the administration menu. In this example, a value of 20 indicates that it should be displayed following to the Pages menu item. Visit the WordPress Codex (https://codex.wordpress.org/Function_Reference/register_post_type) for a full list of potential values for this parameter and their associated positions.
The supports parameter is another array that indicates which parts of the content editor should be displayed for items that use the custom post type. In this case, we left out some sections, such as author, excerpt, trackbacks, revisions, page-attributes, and post-formats, as they were not desirable for Book Reviews.
The next few parameters in the configuration array indicate that we do not want to define custom taxonomies at this time, and specify the path and name of the image file that should be displayed next to the post type's name in the administration menu. Finally, the last two arguments determines whether WordPress should present an archive listing page for the new type when users visit the /book_reviews page on the site and whether or not book reviews should be excluded from search results.
There are actually many other parameters that can be included in the configuration array to get more precise control over some aspects of the new custom post type. Please visit the WordPress Codex (https://codex.wordpress.org/Function_Reference/register_post_type) to learn more about them.