{"id":6368212,"date":"2015-07-27T02:43:54","date_gmt":"2015-07-27T02:43:54","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/why-do_shortcode-is-not-executing-the-shortcode-in-data-html-attributes\/"},"modified":"2016-08-30T16:09:38","modified_gmt":"2016-08-30T16:09:38","slug":"why-do_shortcode-is-not-executing-the-shortcode-in-data-html-attributes","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/why-do_shortcode-is-not-executing-the-shortcode-in-data-html-attributes\/","title":{"rendered":"Why do_shortcode is not executing the shortcode in data-* html attributes?"},"content":{"rendered":"<p>I&#8217;ve already asked this question on wordpress.stackexchange.com and so far I got only one user to reply me and he said that he was unable to reproduce the error.<\/p>\n<p>My request to this sub-forum community is to test the following code, which can be a bug in WordPress. I can reproduce the error on my localhost machine as well as on the remote development server. I&#8217;m simply copy pasting the question to avoid wasting time.<\/p>\n<p>This is on Vanilla installation. I&#8217;ve made a shortcode:-<\/p>\n<pre><code>\/**\n * Creates a shortcode for shortcode_use_here\n * @author Omar Tariq &lt;XXXXXX@gmail.com&gt;\n *\/\nfunction callback_banana_abc( $args ){\n    \/* Don&#039;t echo! Always return *\/\n\n    return &#039;yay!&#039;;\n}\nadd_shortcode( &#039;banana_abc&#039;, &#039;callback_banana_abc&#039; );<\/code><\/pre>\n<p>And I&#8217;ve made a template that looks like this:-<\/p>\n<pre><code>&lt;?php\n\/*\n * Template Name: Test Template\n * Description: Hello world.\n *\/\n\n$str = &#039;&lt;a herf=&quot;#&quot; title=&quot;[banana_abc]&quot; data-abc=&quot;[banana_abc]&quot;&gt;[banana_abc]&lt;\/a&gt;&#039;;\necho do_shortcode($str);<\/code><\/pre>\n<p>The output is:-<\/p>\n<pre><code>&lt;a herf=&quot;#&quot; title=&quot;yay!&quot; data-abc=&quot;[banana_abc]&quot;&gt;yay!&lt;\/a&gt;<\/code><\/pre>\n<p>This is only for data-* attributes. It works fine when used in title attribute.<\/p>\n<p>The actual shortcode is much more complex. I&#8217;ve made it small and to the point to avoid wasting time.<\/p>\n<p>Please let me know if you can reproduce the error.<\/p>\n","protected":false},"template":"","class_list":["post-6368212","topic","type-topic","status-closed","hentry","topic-tag-do_shortcode"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6368212","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\/6368212\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6368212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}