Search code examples
phpwordpresshttp-redirecthookpodscms

How to redirect the user to detail page after saving a new pod item/record in Pods / Wordpress?


After saving a new pod item, I want to redirect the user to the detail page of the newly created record. How can I achieve this?

I tried using post_save hooks but it didn't work. I used the following code:

function redirect_to_detail($data, $is_new_item) {
  $pod_type = $data['params']['pod'];
  $id = $data['params']['id'];
  wp_redirect( home_url() . "/{$pod_type}/{$id}" ); exit;
}

add_filter('pods_api_post_save_pod_item', 'redirect_to_detail', 10, 2);

The pod item is created by a shortcode like this:

[pods name="egitim" form="1" fields="name, salon" label="Kaydet"]

Solution

  • Try this:

    [pods name="egitim" form="1" fields="name, salon" label="Kaydet" thank_you="/egitim/X_ID_X/"]