shortcode from plugin causes The response is not a valid JSON response Error
-
Hello guys, I have a shortcode create from my custom plugin.
This is how I create that shortcode from plugin:class test_plugin{ function __construct() { register_activation_hook(__FILE__, array($this, 'plugin_activation')); register_deactivation_hook(__FILE__, array($this, 'plugin_deactivation')); register_uninstall_hook( __FILE__, 'plugin_uninstallation' ); add_shortcode('my_custom_view_shortcode',array($this,'my_custom_view_handler')); } public static function my_custom_view_handler(){ echo '<div>My view</div>'; } } $test_plugin = new test_plugin();
After activating plugin, I created new page and added shortcode to shortcode block like this [‘my_custom_view_shortcode’].
And now, whenever I press publish or update button in any page/post which contains my custom shortcode [‘my_custom_view_shortcode’] will give me the error ‘Publishing/Updating failed. The response is not a valid JSON response.’
I reloaded my page, all information was still saved in database and showed expected result ‘<div>My view</div>’.
Can you help me how to fix that error? Thank you
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘shortcode from plugin causes The response is not a valid JSON response Error’ is closed to new replies.