{"id":2669931,"date":"2012-04-05T13:28:06","date_gmt":"2012-04-05T13:28:06","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/urlencode-from-shortcode\/"},"modified":"2016-08-20T05:58:29","modified_gmt":"2016-08-20T05:58:29","slug":"urlencode-from-shortcode","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/urlencode-from-shortcode\/","title":{"rendered":"urlencode from shortcode?"},"content":{"rendered":"<p>Hi guys,<\/p>\n<p>when I try to encode a url with urlencode wich was given by the content parameter of a shortcode, than it get&#8217;s encoded wrong. Here&#8217;s the code:<\/p>\n<p><code>function OEreturnData($atts,$content=null){<br \/>\n  extract(shortcode_atts(array(<br \/>\n\t      'maxwidth' =&gt; 500,<br \/>\n\t      'maxheight' =&gt; 281,<br \/>\n     ), $atts));<br \/>\n  var_dump(urlencode($content));<br \/>\n}<\/p>\n<p>add_shortcode('shortcode_name', 'OEreturnData');<\/code><\/p>\n<p>And for example with this value<\/p>\n<p><code>[shortcode_name]http:\/\/herthabsc.de\/index.php?id=3631&amp;tx_ttnews[tt_news]=13144&amp;cHash=9ef2e9ee006fb16188ebf764232a0ba9[\/shortcode_name]<\/code><\/p>\n<p>I get the return of<\/p>\n<p><code>http%3A%2F%2Fherthabsc.de%2Findex.php%3Fid%3D3631%26%23038%3Btx_ttnews%5Btt_news%5D%3D13144%26%23038%3BcHash%3D9ef2e9ee006fb16188ebf764232a0ba9<\/code><\/p>\n<p>But it actually should be<\/p>\n<p><code>http%3A%2F%2Fherthabsc.de%2Findex.php%3Fid%3D3631%26tx_ttnews%5Btt_news%5D%3D13144%26cHash%3D9ef2e9ee006fb16188ebf764232a0ba9%20%20<\/code><\/p>\n<p>What&#8217;s the problem?<\/p>\n","protected":false},"template":"","class_list":["post-2669931","topic","type-topic","status-closed","hentry","topic-tag-shortcode","topic-tag-urlencode"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/2669931","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\/2669931\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=2669931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}