[ad_1]
I wanna create a form with a shortcode so I can use it wherever I need it. I use the below minimal example:
add_shortcode( 'form', 'create_form' );
function create_form () {
require_once __DIR__ . '/form.php';
}
But when I add the shortcode on the post and try to save it, it shows an error: ‘Updating failed. The response is not a valid JSON response.’
I have also noticed that WordPress specifies this: ‘shortcode should never produce an output of any kind’.
If the shortcode is not meant for making such a task, how do I make a form and add it somewhere? Or the shortcode is okay but I misunderstood and doing something wrong?
