WordPress.org

Ready to get started?Download WordPress

Forums

Shortcode form to fetch and present data from external source. (2 posts)

  1. Arfa__
    Member
    Posted 8 months ago #

    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?

  2. Arfa__
    Member
    Posted 8 months ago #

    Whoops, posting in wrong forum, mods could you please move this to the Hacks forum. Thanks!

Reply

You must log in to post.

About this Topic