Before the_content
is displayed WP looks for filters to run the content through. One of those filters is do_shortcode
. The idea of a filter is that you can change something before it is displayed. As a consequence, if inside the filter function you echo something, it ends up before the_content
, which is still waiting for the filtering process to be completed.
Since your function form_shortcode()
does not return a modified content
anything that is displayed must be the result of echo
statements in form.php
.