I wanted to create a CPT named recap.
So, I create mu-plugins folder within wp-includes
I created a new file and named it mycpts-cpt.php
Then, copied your codes by changing: drawing/s with recap/s, photos with my and the URI with the website’s address.
But it is not working. Where did I err?
Here is a copy of the php file I created.
<?php
/*
Recap Name: My CPTs
Recap URI: https://hornaffairs.com/
Description: All My custom code.
Version: 1.0
*/
?>
<?php
add_action( 'init', 'create_my_post_types' );
function create_my_post_types() {
/* Labels for the Recap post type. */
$recaps_labels = array(
'name' => __( 'Recaps', $domain ),
'singular_name' => __( 'Recap', $domain ),
'add_new' => __( 'Add New', $domain ),
'add_new_item' => __( 'Add New Recap', $domain ),
'edit' => __( 'Edit', $domain ),
'edit_item' => __( 'Edit Recap', $domain ),
'new_item' => __( 'New Recap', $domain ),
'view' => __( 'View Recap', $domain ),
'view_item' => __( 'View Recap', $domain ),
'search_items' => __( 'Search Recaps', $domain ),
'not_found' => __( 'No Recaps found', $domain ),
'not_found_in_trash' => __( 'No Recaps found in Trash', $domain ),
);
/* Arguments for the Recap post type. */
$recaps_args = array(
'labels' => $recaps_labels,
'capability_type' => 'post',
'public' => true,
'has_archive' => true,
'can_export' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'Recaps', 'with_front' => true ),
'taxonomies' => array( 'post_tag', 'category'),
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', "my-post-settings" ),
);
/* Register the Recap post type. */
register_post_type( apply_filters( 'my_Recaps_post_type', 'Recaps' ), apply_filters( 'my_Recaps_post_type_args', $recaps_args ) );
}
?>