[wp-trac] [WordPress Trac] #47816: Shortcodes being run in editor when gutenberg is active
WordPress Trac
noreply at wordpress.org
Thu Aug 1 21:35:38 UTC 2019
#47816: Shortcodes being run in editor when gutenberg is active
--------------------------+-----------------------------
Reporter: karlazz | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.2.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hello,
We have a shortcode that makes an API call to a remote site. We noticed
that it was making calls when we were editing pages on our website, even
if the shortcode was not loaded on that page. This does not happen when
gutenberg is disabled.
I made up a test shortcode that appends to a file in the uploads
directory.
I added it to a test page. It ran when I opened the editor view of the
page. It ran when I saved the page. It ran when I viewed the page, which
is the only time it should run. I can see when it runs because it writes
to my file.
Even more surprising is that the shortcode ran when I edited a different
page, a page without the shortcode. We have good reason to believe that
the pages API is running the shortcode when it runs to create the parent
page drop down selector.
Why do we believe that is the issue? Because in the first incident, the
one where we were sending out unexpected API calls to a remote system, the
shortcode was just echoing text without doing a proper return. The echoed
text interrupted the Parent page drop down selector build and so that drop
down did not appear. We saw the shortcode's misplaced response text in
our browser console as part of the page API response. Once we properly
wrapped the echo statement, that issue went away, but the API calls were
still occurring, and so I did the simple test for you.
In summary, the shortcode is run when I edit any page. We believe that
the page API call that is used to create the parent page dropdown is
running the shortcode.
Is this on purpose behaviour?
Regards,
Karla
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47816>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list