【问题标题】:Wordpress Admin Panel Code InputWordpress 管理面板代码输入
【发布时间】:2010-05-31 14:28:52
【问题描述】:

我的一个主题有一个 wordpress 管理面板,其中一个框输入了一些代码来驱动 google adsense。当我将代码放入框中并使用我的 php 标签调用它时,代码如下所示:

        <script type="\&quot;text/javascript\&quot;"><!--
google_ad_client = \"pub-9295546347478163\";
/* Leaderboard 5/17/2010 */
google_ad_slot = \"7593465074\";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="\&quot;text/javascript\&quot;" src="%5C%22http://pagead2.googlesyndication.com/pagead/show_ads.js%5C%22">
</script>   

我认为这是一个阻止 SQL 注入的功能。我怎样才能从一个盒子里调用纯代码?这就是我目前设置文本框的方式。

            array(  "name" => "Code for Top ad",
                    "desc" => "Enter the HTML that will drive the banner ad for the page header",
                    "id" => $shortname."_headerAd",
                    "type" => "textarea"),      

然后用这个回显:

    <?php echo get_option('lifestyle_headerAd'); ?>

【问题讨论】:

    标签: php javascript wordpress wordpress-theming


    【解决方案1】:

    当您从 POST 保存数据时,您是否正在剥离? WordPress 会自动为 GET 和 POST 添加魔术引号,您需要在保存之前对其进行清理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-26
      • 2016-11-18
      • 2012-06-20
      • 2018-09-08
      • 1970-01-01
      • 2019-09-21
      • 1970-01-01
      相关资源
      最近更新 更多