{"id":427,"date":"2026-05-13T21:00:25","date_gmt":"2026-05-14T00:00:25","guid":{"rendered":"https:\/\/www.portanova.com.br\/notebook\/?p=427"},"modified":"2026-05-21T09:05:56","modified_gmt":"2026-05-21T12:05:56","slug":"embed-shortcode","status":"publish","type":"post","link":"https:\/\/www.portanova.com.br\/notebook\/embed-shortcode\/","title":{"rendered":"[MU] Como preservar o shortcode &#91;embed&#93;"},"content":{"rendered":"<h2>\ud83d\udcd8 MU-Plugin: Preservar o shortcode EMBED no editor (vers\u00e3o final)<\/h2>\n<p><strong>Arquivo:<\/strong> <code>\/wp-content\/mu-plugins\/embed-nativo-preservado.php<\/code><\/p>\n<hr \/>\n<pre><code>&lt;?php\r\n\/**\r\n * Plugin Name: Embed Nativo Preservado (Final)\r\n * Description: Mant\u00e9m o shortcode no banco de dados, sem convers\u00e3o em HTML, e sem quebrar o editor visual.\r\n * Version: 3.0\r\n * Author: Reinaldo (Portanova)\r\n *\/\r\n\r\nif ( ! defined( 'ABSPATH' ) ) {\r\n    exit;\r\n}\r\n\r\n\/\/ 1. Impede que o oEmbed converta o shortcode em HTML ao salvar o post\r\nadd_filter( 'pre_oembed_result', function( $result, $url, $args ) {\r\n    \/\/ Para qualquer URL, independente do tipo (\u00e1udio, v\u00eddeo, etc.), interrompe a convers\u00e3o\r\n    return false;\r\n}, PHP_INT_MAX, 3 );\r\n\r\n\/\/ 2. Garante que o shortcode seja renderizado corretamente no front-end\r\nadd_filter( 'the_content', function( $content ) {\r\n    if ( has_shortcode( $content, 'embed' ) ) {\r\n        global $wp_embed;\r\n        $content = $wp_embed-&gt;run_shortcode( $content );\r\n    }\r\n    return $content;\r\n}, 10 );\r\n\r\n\/\/ 3. Permite que o shortcode&lt; passe ileso pelos filtros de seguran\u00e7a (KSES)\r\nadd_filter( 'pre_kses', function( $content ) {\r\n    if ( strpos( $content) !== false ) {\r\n        return $content;\r\n    }\r\n    return $content;\r\n}, 1 );\r\n?&gt;\r\n\r\n\r\n<\/code><\/pre>\n<p>==============================<\/p>\n<p><strong>Instru\u00e7\u00f5es:<\/strong><\/p>\n<ol>\n<li>Crie o arquivo com o nome indicado dentro da pasta <code>\/wp-content\/mu-plugins\/<\/code>.<\/li>\n<li>Limpe o cache do navegador e, se houver, o cache do WordPress.<\/li>\n<li>Fa\u00e7a logout e login novamente.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udcd8 MU-Plugin: Preservar o shortcode EMBED no editor (vers\u00e3o final) Arquivo: \/wp-content\/mu-plugins\/embed-nativo-preservado.php &lt;?php \/** * Plugin Name: Embed Nativo Preservado (Final) * Description: Mant\u00e9m o shortcode no banco de dados, sem convers\u00e3o em HTML, e sem quebrar o editor visual. * Version: 3.0 * Author: Reinaldo (Portanova) *\/ if ( ! defined( &#8216;ABSPATH&#8217; ) ) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,4],"tags":[],"class_list":["post-427","post","type-post","status-publish","format-standard","hentry","category-lessons","category-pluginsmu"],"_links":{"self":[{"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/posts\/427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/comments?post=427"}],"version-history":[{"count":0,"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/posts\/427\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/media?parent=427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/categories?post=427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.portanova.com.br\/notebook\/wp-json\/wp\/v2\/tags?post=427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}