Prevent gutenberg from rendering shortcodes when editing
-
I have a plugin, which is a shortcoder with an analytics module that increments its required fields when a relevant shortcode is being rendered.
When using Gutenberg, those counters are incremented every time the “edit post” page is opened if it contains the shortcodes. (I think that I’ve seen it increment them even if there are none, but I was unable to replicate it)
Currently I’m turning off the analytics module if the request is to the REST API, like
if(defined('REST_REQUEST') && REST_REQUEST ) $this->isOn = false;
, because the increments used to happen on save as well.What would be a good way to catch all of the requests that are made to pages with gutenberg(“add new post/page” page, save post action etc) to prevent the analytics from firing when it shouldn’t?
- The topic ‘Prevent gutenberg from rendering shortcodes when editing’ is closed to new replies.