Filter: wr_template_modify_payload
This filter is provided in the LoadTemplate Action which is used to redirect to a new template, for example, following a button click.
External Plugins can use the filter to change the template payload that is loaded after the redirect.
The payload will be added as get params to the redirect.
The example below would add the get param “project_id” to the redirect url.
Example: Add Param project_id to redirect url
add_filter( 'wr_template_modify_payload', array( $this, 'set_project_id_for_request_button' ), 10, 2 );
public function set_project_id_for_request_button( array $payload, $post ): array {
if ( $payload['template'] === "TemplateIdentifier" ) {
$payload['project_id'] = 42;
}
return $payload;
}