Wp页面编辑区域中添加了不需要的自定义域

时间:2017-03-08 作者:shpwebhost

我已经制作了一个插件,其中需要post meta?现在我得到了不需要的自定义字段。enter image description here下面是我用来在post type=recommendation中添加自定义meta的代码

add_meta_box(\'plugin-recommendation-box\', \'Recommendation\', \'add_plugin_recommendation_box\', \'recommendations\', \'normal\', \'default\');


    function add_plugin_recommendation_box(){
    global $post;
    $title = get_post_meta($post->ID, \'recommendation_title1\', true);
    $price = get_post_meta($post->ID, \'recommendation_price\', true);
    $reg_price = get_post_meta($post->ID, \'recommendation_reg_price\', true);
    $rating=    get_post_meta($post->ID, \'recommendation_rating\', true);
    $pros=get_post_meta($post->ID, \'recommendation_pros\', true);
    $cons=get_post_meta($post->ID, \'recommendation_cons\', true);
    $specs=get_post_meta($post->ID, \'recommendation_specs\', true);
    $url=get_post_meta($post->ID, \'recommendation_url\', true);
    $custom_url=get_post_meta($post->ID, \'custom_url\', true);
    $rec_short_dec=get_post_meta($post->ID, \'rec_short_dec\', true);
    $ratings=get_post_meta($post->ID, \'recommendation_ratings\', true);
    $trybtn=get_post_meta($post->ID, \'recommendation_trybtn\', true);
    $curr=get_post_meta($post->ID, \'recommendation_currency\', true);
    $compare_subtitle=get_post_meta($post->ID, \'compare_subtitle\', true);
    $compare_price_1=get_post_meta($post->ID, \'compare_price_1\', true);
    $compare_price_2=get_post_meta($post->ID, \'compare_price_2\', true);
    $compare_price_3=get_post_meta($post->ID, \'compare_price_3\', true);
    $compare_price_4=get_post_meta($post->ID, \'compare_price_4\', true);
    $compare_price_plan_1=get_post_meta($post->ID, \'compare_price_plan_1\', true);
    $compare_price_plan_2=get_post_meta($post->ID, \'compare_price_plan_2\', true);
    $compare_price_plan_3=get_post_meta($post->ID, \'compare_price_plan_3\', true);
    $compare_price_plan_4=get_post_meta($post->ID, \'compare_price_plan_4\', true);
    $compare_price_plan_short_desc=get_post_meta($post->ID, \'compare_price_plan_short_desc\', true);
    $compare_price_short_desc=get_post_meta($post->ID, \'compare_price_short_desc\', true);
    $offer_price_short_desc=get_post_meta($post->ID, \'offer_price_short_desc\', true);
    $offer_sale_text=get_post_meta($post->ID, \'offer_sale_text\', true);
    $offer_image=get_post_meta($post->ID, \'offer_image\', true);
    $offer_subtitle_text=get_post_meta($post->ID, \'offer_subtitle_text\', true);
    $coupon_code=get_post_meta($post->ID, \'coupon_code\', true);
    $coupon_detail=get_post_meta($post->ID, \'coupon_detail\', true);
    $coupon_start_date=get_post_meta($post->ID, \'coupon_start_date\', true);
    $coupon_end_date=get_post_meta($post->ID, \'coupon_end_date\', true);
    $top_10_basic_feature1=get_post_meta($post->ID, \'top_10_basic_feature1\', true);
    $top_10_basic_feature2=get_post_meta($post->ID, \'top_10_basic_feature2\', true);
    $top_10_basic_feature3=get_post_meta($post->ID, \'top_10_basic_feature3\', true);
    $top_10_basic_feature4=get_post_meta($post->ID, \'top_10_basic_feature4\', true);
    $top_10_basic_feature5=get_post_meta($post->ID, \'top_10_basic_feature5\', true);
    $top_10_advance_feature1=get_post_meta($post->ID, \'top_10_advance_feature1\', true);
    $top_10_advance_feature2=get_post_meta($post->ID, \'top_10_advance_feature2\', true);
    $top_10_advance_feature3=get_post_meta($post->ID, \'top_10_advance_feature3\', true);
    $top_10_advance_feature4=get_post_meta($post->ID, \'top_10_advance_feature4\', true);
    $top_10_advance_feature5=get_post_meta($post->ID, \'top_10_advance_feature5\', true);
    $rec_expert_feature1=get_post_meta($post->ID, \'rec_expert_feature1\', true);
    $rec_expert_feature2=get_post_meta($post->ID, \'rec_expert_feature2\', true);
    $expert_feature1_title=get_post_meta($post->ID, \'expert_feature1_title\', true);
    $expert_feature2_title=get_post_meta($post->ID, \'expert_feature2_title\', true); 
    $expert_trend=get_post_meta($post->ID, \'expert_trend\', true);   
    $sch_popup_feature1=get_post_meta($post->ID, \'sch_popup_feature1\', true);
    $sch_popup_feature2=get_post_meta($post->ID, \'sch_popup_feature2\', true);   

1 个回复
最合适的回答,由SO网友:Ben Casey 整理而成

您可以在屏幕选项中隐藏此选项,应该有一个“自定义字段”复选框

相关推荐

Testing Plugins for Multisite

我最近发布了一个WordPress插件,它在单个站点上非常有效。我被告知该插件在多站点安装上不能正常工作,我理解其中的一些原因。我已经更新了代码,现在需要一种方法来测试更新后的代码,然后才能转到实时客户的多站点安装。我有一个用于测试的WordPress安装程序的单站点安装,但需要在多站点安装上进行测试。根据我所能找到的唯一方法是在网络上至少有两个站点来安装整个多站点安装,以测试我的插件。设置WordPress的整个多站点安装是插件开发人员的唯一/首选方式,还是有更快的测试环境可用。