{"id":309,"date":"2024-02-01T10:46:19","date_gmt":"2024-02-01T10:46:19","guid":{"rendered":"http:\/\/localhost\/syllogic\/wp\/?p=309"},"modified":"2024-02-02T12:22:27","modified_gmt":"2024-02-02T12:22:27","slug":"modify-a-custom-post-type-registration-with-the-registered_post_type-hook","status":"publish","type":"post","link":"http:\/\/localhost:10008\/modify-a-custom-post-type-registration-with-the-registered_post_type-hook\/","title":{"rendered":"Modify a Custom Post Type Registration with the registered_post_type Hook"},"content":{"rendered":"\n
add_action( 'registered_post_type', 'gs_books_label_rename', 10, 2 );\n\n\/**\n* Modify registered post type menu label\n*\n* @param string $post_type Registered post type name.\n* @param array $args Array of post type parameters.\n*\/\n\nfunction gs_books_label_rename( $post_type, $args {\n if ( 'gs_books' === $post_type ) {\n global $wp_post_types;\n $args->labels->menu_name = __( 'Books', 'gs_books' );\n $wp_post_types[ $post_type ] = $args; \n }\n}<\/code><\/pre>\n\n\n\n