How can I pass the results of a WP_Query
call to a plugin? I've tried passing the data via a shortcode attribute, but I get the error "Object of class WP_Query could not be converted to string".
E.g.:
$args = array(
// ...
);
$the_query = WP_Query($args);
echo do_shortcode( [example_custom_plugin query_payload="' . $the_query . '"] );
What are the different (and best advised) ways for a plugin to retrieve variables (which may be objects or arrays of data) that the WP template has set?
In my case, my plugin is instantiated via the shortcode call, hence why I am approaching it from that perspective; I want the plugin to have the results of the WP_Query at instantiation.