Add filter to FES redirect url

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 5 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31439

    I’m loading the FES form through a Woocommerce account endpoint, which means the form submission page itself doesn’t have a unique post id, just the id of the account dashboard page.

    The URL redirect (class-eo-event-form.php get_redirect_url()) only allows you to set a post id to redirect to. In this case it would return to the dashboard rather than event submission page.

    This can be worked around by adding an earlier hooked action to eventorganiser_fes_submitted_event, which in turn adds a filter to post_type_link (as it would only be when submitting the event that I need to filter the link) – which then checks I am filtering the correct page, just in case some other permalink is called in between, but this seems a rather clunky way of dealing with things.

    Can the permalink used by this function be filtered to allow for an endpoint to be added (or the url totally changed!) before the query args are added?

    • This topic was modified 5 years, 8 months ago by  Owen Morris.
    Owen Morris
    #31502

    Hi Owen,

    You can instead just hook into the action that triggers the redirect, but before the redirect happens and redirect to your own url. 150 priority is used by the plug-in, so if you pick 149, your code will run first:

    add_action( 'eventorganiser_fes_submitted_event', function(){
        wp_redirect( '... your url...' );
        exit();
    }, 149, 3 );
    
    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.