<?php 
if($result_array['ACK']== 'Success'){
  global $wpdb;
  $wpdb->insert('wp_paypal_payment', array(
    'amount' => $result_array['AMT'],
    'post_id' => $_REQUEST['post_id'],
    'firstname' => $_REQUEST['first_name'],
    'lastname' => $_REQUEST['last_name']
  ));  
  wp_redirect( get_page_by_title( 'thank-you' ) );
}else{
  header("Location : http://localhost/mysite/faq");
}
?>

My query is working but I have no idea that how I simply redirect in my page and display any my page content data in wordpress. So please help me.

1 Answer
1

You should get ID of the page you’re looking for:

$page = get_page_by_title('thank-you');
wp_redirect(get_permalink($page->ID));
exit;

It looks like you want to get page by slug. If that’s the case, you should use this function instead.

Also, for Location header don’t use space after “Location” string:

header("Location: http://localhost/mysite/faq");

Leave a Reply

Your email address will not be published. Required fields are marked *