Bonjour à tous,

Pourriez vous m'aider?

Voilà j'ai un système de paiement avec un webhook, qui renvoi vers un script wordpress. Le truc c'est que j'aimerais faire les manipulations qui'il faut et après rediriger vers une page de remerciement.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
 
/**
 * Redirect URL functions
 *
 * @since   1.5.0
 *
 */
 
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
 
/**
 * Function to show a message and payment details after the purchase
 *
 * @param  mixed $content WP the_content.
 *
 * @return mixed $html
 *
 * @since 1.0.0
 */
function pt_show_payment_details( $content ) {
 
	global $pt_script_options;
	global $pt_mollie;
 
	$place_above = ( $pt_script_options['other']['payment_details_placement'] == 'above' ? true : false );
 
	$html = '';
 
	if ( in_the_loop() && is_main_query() ) {
 
		if ( isset( $_GET['pt-payment'] ) ) {
 
			$payment_id = $_GET['pt-payment'];
			$payment    = pt_get_payment_by_payment_key( $payment_id );
 
			$pretty_status = __( $payment->get_status() );
 
			error_log( 'Shown after payment message for payment_id: ' . print_r( $payment->id, true ) );
 
			$payment_status_style = ( $payment->status == 'paid' || $payment->no_payment == true ) ? 'pt-payment-details-wrap' : 'pt-payment-details-wrap pt-payment-details-error';
 
			$html = '<div class="' . $payment_status_style . '">' . "\n";
 
			if (( $payment->status == 'open' ) && ( $payment->no_payment == true ) ){
				$html .= __( 'Thank you for your submission! We will get in touch shortly!', 'paytium' );
			} elseif ( $payment->status == 'paid' ) {
				$html .= __( 'Thank you for your order, the status is:', 'paytium' ) . ' <b>' . strtolower($pretty_status) . '</b>.' . "\n";
			} elseif (( $payment->status == 'open' ) && ( $payment->no_payment == false ) ) {
				$html .= sprintf( __( 'The payment is: %s, this status might still change.', 'paytium' ), '<b>' . strtolower($pretty_status) . '</b>' ) . "\n";
			} else {
				$html .= __( 'The payment status is:', 'paytium' ) . ' <b>' . strtolower($pretty_status) . '</b>.' . "\n";
			}
 
			if ( ! empty( $payment->subscription_id ) ) {
				$html .= '<br />';
				$html .= __( 'Your subscription has been created with id', 'paytium' ) . ' <b>' . $payment->subscription_id . '</b>.' . "\n";
			}
 
			$html .= '</div>' . "\n";
			// compteur nombre d'imagegrabscreen
			// si reforestation et si payment alors
			if(find_affectation_reforestation($payment->field_data))
				do_action( 'update_counter_number_donation', (int)$payment->payment_amount);
 
			// Add custom hook after payment
			if(!empty($payment->subscription_interval))
				do_action( 'paytium_after_pt_show_payment_details', $payment );
 
			$html = '<div class="col-md-12">
				<div class="vc_row wpb_row vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div style="background-color: #FFF;" class="vc_column-inner "><div class="wpb_wrapper"><div class="wpb_pinterest wpb_content_element wpb_pinterest_type_horizontal"><span class="PIN_1543549586752_button_pin PIN_1543549586752_save" data-pin-log="button_pinit_bookmarklet" data-pin-href="https://fr.pinterest.com/pin/create/button/">Enregistrer</span></div><div class="wpb_pinterest wpb_content_element wpb_pinterest_type_horizontal"><span class="PIN_1543549586752_button_pin PIN_1543549586752_save" data-pin-log="button_pinit_bookmarklet" data-pin-href="https://fr.pinterest.com/pin/create/button/">Enregistrer</span></div><div class="vc_empty_space" style="height: 100px"><span class="vc_empty_space_inner"></span></div>
</div></div></div></div><div class="vc_row wpb_row vc_row-fluid ult-vc-hide-row vc_row-has-fill" style="position: relative;" data-rtl="false" data-row-effect-mobile-disable="true" data-img-parallax-mobile-disable="true"><div class="upb_row_bg vcpb-default" data-upb_br_animation="" style="background-size: cover; background-repeat: repeat; background-color: rgb(209, 51, 25); background-image: url(&quot;https://planete-urgence.org/wp-content/uploads/2018/11/don-actions-planete-urgence.png&quot;); background-attachment: scroll; min-width: 1150px; left: 0px; width: 1150px;" data-parallax_sense="30" data-bg-override="0" data-bg-animation="left-animation" data-bg-animation-type="h" data-animation-repeat="repeat"></div><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner " style="background-color: #FFF;margin-top: 5vh;"><div class="wpb_wrapper">
	<div class="wpb_text_column wpb_content_element  vc_custom_1542997849258">
		<div class="wpb_wrapper">
			<h3 style="text-align: left;"><strong><span style="color: #e7573e;">MERCI DE VOTRE SOUTIEN !!!</span></strong></h3>
<h3 style="text-align: left;"><strong><span style="color: #e7573e;">NOUS VOUS REMERCIONS POUR VOTRE GÉNÉROSITÉ</span></strong></h3>
<p>&nbsp;</p>
<p style="text-align: left;"><strong>Votre don a bien été enregistré. Au nom de toute l’équipe Planète Urgence nous vous remercions chaleureusement pour votre </strong><strong>générosité. Vous allez recevoir un mail de confirmation ainsi que votre reçu fiscal dans les 24h qui viennent.</strong></p>
<p style="text-align: left;">Grâce à votre précieux soutien, nous avons déjà pu planté un total de 7 millions d’arbres, accompagné x bénéficiaires et financé 20 000 kits scolaires. Notre ambition est de renforcer les compétences des partenaires locaux pour accéder à leur autonomie. Pour en savoir plus sur l’impact de cette année, nous vous invitons à consulter la page suivante : <a href="https://54.38.181.29/pu/index.php/environnement-developpement/">Intervention de Planète Urgence</a></p>
<p>&nbsp;</p>
<p style="text-align: left;">En cas d’erreur, vous pouvez nous en informer par mail à l’adresse suivante : relationdonateur@planete-urgence.org ou par téléphone au 01 58 30 51 10.</p>
		</div>
	</div>
</div></div></div></div><!-- Row Backgrounds -->
			</div><!-- /.col-md-12 -->';
 
			return $html;
 
		}
	}
 
	if ( $place_above ) {
		return apply_filters( 'pt_payment_details', $html ) . $content;
	} else {
		return $content . apply_filters( 'pt_payment_details', $html );
	}
 
}
/* check if affectation is for reforestation */
function find_affectation_reforestation($payment) : bool
{
	if(empty($payment)) return false;
	foreach($payment as $item1)
	{
		if(is_array($item1))
		{
			foreach($item1 as $item2)
			{
				if(preg_match("/(refo)/i",$item2))
					return true;
			}
 
		}
	}
	return false;
}
// ma redirection
function redirect_thanks_page(){
	if ( in_the_loop() && is_main_query() ) {
	if ( isset( $_GET['pt-payment'] ) ) {
		return home_url() . '/remerciement';
	}}
}
 
add_filter( 'the_content', 'pt_show_payment_details', 11 );
$url = add_filter( 'the_content', 'redirect_thanks_page',12 );
if(filter_var('$url, FILTER_VALIDATE_URL))
 {
     wp_redirect($url);
     die;
}
Le problème est que je n'arrive pas à rediriger vers ma page je pense que c'est liée à un problème de header, comment puis je identifier le problème?

Merci