duanjinchi1982 2012-09-22 07:20
浏览 45
已采纳

在wordpress中保存页面后,div id消失了

I am encountering a strange problem in wordpress as the 'id' attribute gets disappeared from the '' after saving page in wordpress.

This means if I try to save '' in a page then after save it shows ''.

I don't get a clue to fix this issue.

So please help me in sorting out this problem as soon as possible.

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • donglu8779 2012-09-22 08:30
    关注

    The problem and solution are described in detail here: http://wordpress.org/support/topic/wp_update_post-strips-css-id-attribute?replies=7

    In short, this is due to WordPress' KSES module, which according to WordPress,

    ...makes sure that only the allowed HTML element names, attribute names and attribute values plus only sane HTML entities will occur in $string.

    According to the post, one of the contributors solved this problem by "inserting the following code just before the call to wp_update_post."

    global $allowedposttags;
    $allowedposttags['div'] = array('align' => array (), 'class' => array (), 'id' => array (), 'dir' => array (), 'lang' => array(), 'style' => array (), 'xml:lang' => array() );
    $allowedposttags['iframe'] = array('src' => array () );
    

    For a global solution, make sure to include:

    define('CUSTOM_TAGS', true);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?