{"id":10002078,"date":"2018-02-22T09:18:53","date_gmt":"2018-02-22T09:18:53","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/get_posted_data-returns-wrong-array\/"},"modified":"2018-02-22T09:18:53","modified_gmt":"2018-02-22T09:18:53","slug":"get_posted_data-returns-wrong-array","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/get_posted_data-returns-wrong-array\/","title":{"rendered":"get_posted_data returns wrong array"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I&#8217;m using last version of plugin (5.0). I want to modify dynamically the email address where is sent. I have this function for test purposes:<\/p>\n<p>add_action( &#8216;wpcf7_before_send_mail&#8217;, &#8216;action_wpcf7_before_send_mail&#8217; );<br \/>\nfunction action_wpcf7_before_send_mail( $contact_form ) {<br \/>\n    if (1093 == $contact_form-&gt;id()) {<\/p>\n<p>        $wpcf7 = $contact_form::get_current();<br \/>\n        $submission = WPCF7_Submission::get_instance();<br \/>\n        if ($submission) {<br \/>\n            $posted_data = $submission-&gt;get_posted_data();<br \/>\n            $mail = $wpcf7-&gt;prop(&#8216;mail&#8217;);<br \/>\n            $mail[&#8216;body&#8217;] .= print_r($posted_data,true);<br \/>\n            $wpcf7-&gt;set_properties(array(<br \/>\n                &#8220;mail&#8221; =&gt; $mail<br \/>\n            ));<br \/>\n            return $wpcf7;<br \/>\n        }<br \/>\n    }<br \/>\n};<\/p>\n<p>I want to capture posted data, and I get the array but this way:<\/p>\n<p>Array<br \/>\n(<br \/>\n1093 =&gt; 1093<br \/>\n5.0 =&gt; 5.0<br \/>\nes_ES =&gt; es_ES<br \/>\nwpcf7-f1093-o1 =&gt; wpcf7-f1093-o1<br \/>\n0 =&gt; 0<br \/>\neeepeee =&gt; eeepeee<br \/>\ntrtrt@dfsf.com =&gt; trtrt@dfsf.com<br \/>\nfsdf asfsdfsf =&gt; fsdf asfsdfsf<br \/>\n)<\/p>\n<p>The array keys have same values as de array values, so I can&#8217;t capture data. Anyone experience the same behavior?<\/p>\n<p>Is this a bug?<\/p>\n<p>Thanks<\/p>\n","protected":false},"template":"","class_list":["post-10002078","topic","type-topic","status-publish","hentry","topic-tag-post","topic-tag-submission"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10002078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10002078\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=10002078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}