I am trying to add a custom post type by just copying and pasting the following code from WordPress website to my functions.php
function create_post_type() {
register_post_type( 'acme_product',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
'has_archive' => true,
)
);
}
add_action( 'init', 'create_post_type' );
When I run this code and try to go to WordPress dashboard, I get the following error:
Parse error: syntax error, unexpected 'function' (T_FUNCTION) in C:\xampp\htdocs\learningwordpress\wp-content\themes\learningWordPress\functions.php on line 200
I tried to look for answers and in many cases this error happens when your PHP version is older than 5.3 but I am using PHP version: 7.1.18, so it cannot be because of that.