使用ADD_POST_META()将HTML格式的数据保存到POST META

时间:2013-02-27 作者:Jagan K

   Array
(
    [post] => Array
        (
            [jw_objective] => Exposure to e<b>nd to end development</b> of various applications; right from requirement analysis to system study, designing, coding, testing, de-bugging, <i>documentation and i</i>mplementation. Adept in <u>handling the design and coding functions</u>
            [postid] => 363
            [jw_fullname] => Pradeep
            [jw_email] => [email protected]
            [jw_phone] => 9952149811
            [jw_website] => www.por.com
            [jw_address1] => 83, VGP Nagar East
            [jw_address2] => T Nagar
            [jw_address3] => Chennai, India 605602
            [jw_title] => Senior Web Developer
            [jw_cname] => TPF Software Solutions
            [jw_startdate] => Dec 2010
            [jw_enddate] => Present
            [jw_desc] => This is my responsibilit<b>es in this job</b>
            [jw_qualifications] => Certified Public Acc<i>ountant (CPA)
                        Certified Management Accountant (CMA)
                        Certified Financial Manager (CFM)
                        Certified Fraud Examiner (CF</i>E)
                        Cer<b>tified Financial Planner (CFP)
                        Certified Internal Auditor (CIA)
                        Enrolled Agent (EA)
                        Certified Government Financial Manager (CGFM)
                                                                        </b>
            [jw_educname] => B.E
            [jw_eduiname] => Arunai College of Engineering
            [jw_edustartdate] => May 2005
            [jw_eduenddate] => May 2009
            [jw_edudesc] => This is a riduculous thing happen<b><i>ed in my life, </i></b>
            [jw_interest] => Th<i>ese are my interests</i>
            [jw_referance] => This Is my referance
        )

    )
这是我遍历的数组,并将其添加到wp_postmeta 通过以下foreach循环

foreach ($_POST AS $key => $value) {
    add_post_meta($pid, $key, $value, true);
} 
该信息是从自定义表单发布的。

我遇到的问题是HTML标记<b><i> 在进入数据库时自动剥离。HTML是从jquery所见即所得编辑器生成的

但信息保存成功。有没有办法用HTML标记保存Posteta?

2 个回复
SO网友:GhostToast

是因为您的标签正在被剥离,还是因为您在显示它们之前没有准备好它们。尝试包装输出:

echo apply_filters(\'the_content\', get_post_meta($post->ID, \'_custom_field_name\', true));

SO网友:Abdo-Host

更新时使用addslashes(); 和打印使用stripslashes();

结束

相关推荐

列出分类法:如果分类法没有POST,就不要列出分类法--取决于定制的POST-META?

这可能很难解释,我不知道是否有解决办法!?我有一个名为“wr\\u event”的自定义帖子类型和一个名为“event\\u type”的分层自定义分类法。自定义帖子类型有一个元框,用于event_date 并且与此帖子类型关联的所有帖子都按以下方式排序event_date. 我在循环中有一个特殊的条件来查询event_date 已经发生了-在这种情况下,它没有显示,但只列在我的档案中。就像你可以使用wp_list_categories() 我编写了一个自定义函数,它以完全相同的方式列出所有分类术语。现在