Shortcode form to fetch and present data from external source.
I have a shortcode that presents a form allowing the user to search for data in an external source. The shortcode will parse the submitted form parameters, run the query and then return the data.
All fine and good, except being a filter, the query of external source is run twice or even more often. 🙁
So, Google’ing about, it seems the correct architecture is for shortcode to have no side effects, just dump and form and do nowt else. Then use an init hook to process the form. That make sense, but where should the init hook put the results and how should the shortcode then get hold of the results and return them for display within a post?
- The topic ‘Shortcode form to fetch and present data from external source.’ is closed to new replies.