{"id":15144341,"date":"2021-12-08T16:59:52","date_gmt":"2021-12-08T16:59:52","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/adding-blocking-behavior-not-working\/"},"modified":"2021-12-08T16:59:52","modified_gmt":"2021-12-08T16:59:52","slug":"adding-blocking-behavior-not-working","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/adding-blocking-behavior-not-working\/","title":{"rendered":"Adding blocking behavior not working"},"content":{"rendered":"<p>Hi team!<\/p>\n<p>I love your plugin and I&#8217;ve been using it for years! I am implementing a consent management platform these days and ran into a problem on how to add the data-block-on-consent attribute to different embedds like instagram and youtube. <\/p>\n<p>My idea was to implement it in two different ways of which none of them work:<\/p>\n<p><strong>1. functions.php<\/strong><\/p>\n<pre><code>add_filter( &#039;the_content&#039;, function( $content ) {\n    if ( function_exists( &#039;is_amp_endpoint&#039; ) &amp;&amp; is_amp_endpoint() ) {\n        $content = str_replace(&quot;&lt;amp-instagram&quot;, &quot;&lt;amp-instagram data-block-on-consent&quot;, $content);\n    }\n    return $content;\n}, 1 );<\/code><\/pre>\n<p><strong>1. custom template single.php<\/strong><\/p>\n<pre><code>$content = $this-&gt;get( &#039;post_amp_content&#039; );\n $content = str_replace(&quot;&lt;amp-instagram&quot;, &quot;&lt;amp-instagram data-block-on-consent&quot;, $content);<\/code><\/pre>\n<p>Is there any other way how to add that attribute to the AMP components?<\/p>\n<p>Any help is much appreciated!<\/p>\n<p>Best,<\/p>\n<p>Jonas<\/p>\n","protected":false},"template":"","class_list":["post-15144341","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15144341","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\/15144341\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=15144341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}