When using mu-plugins I continually get JSON error.

[ad_1]

I have been having a lot of issues lately while creating custom post types. As per a tutorial online I created an mu-plugins directory in my wp-content directory. I created a custom\_post\_types.php file which has the following code:

function *custom\_post\_types*(){
*register\_post\_type*(‘show’, array(
‘rewrite’ => array(‘slug’ => ‘shows’),
‘has\_archive’ => true,
‘show\_in\_rest’ => true,
‘supports’ => array(‘title’, ‘editor’, ‘excerpt’),
‘public’ => true,
‘menu\_icon’ => ‘dashicons-calendar’,
‘labels’ => array(
‘name’ => ‘Shows’,
‘singular\_name’ => ‘Show’,
‘add\_new\_item’ => ‘Add New Show’,
‘edit\_item’ => ‘Edit Show’,
)
));
}
*add\_action*(‘init’, ‘custom\_post\_types’);

Now whenever I create a new post from my wordpress dashboard, standard or custom, I get the following error:

Updating Failed. The response is not a valid JSON response.

However, once I place the same function into my functions.php file in my theme directory there is no issue. I am not using any plugins currently. Is there an issue with having this function in my functions.php file as opposed to its own which is being called from the mu-plugins directory?

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer