0
在的WordPress 4.7我試圖添加/更新後的元當管理員創建或作出改變到WooCommerce產品在儀表板。添加/更新後的元后,新/編輯自定義後類型後
我使用的動作save_post_post_type
作爲節目的功能做這從WP3.7 +在使用:https://developer.wordpress.org/reference/hooks/save_post_post-post_type/
這裏是我的功能:
function my_function() {
update_post_meta($post_id, '_gravity_form_data', 'a:15:{s:2:"id";s:1:"3";s:13:"display_title";b:0;s:19:"display_description";b:0;s:25:"disable_woocommerce_price";s:2:"no";s:12:"price_before";s:0:"";s:11:"price_after";s:0:"";s:20:"disable_calculations";s:2:"no";s:22:"disable_label_subtotal";s:2:"no";s:21:"disable_label_options";s:2:"no";s:19:"disable_label_total";s:2:"no";s:14:"disable_anchor";s:2:"no";s:14:"label_subtotal";s:8:"Subtotal";s:13:"label_options";s:7:"Options";s:11:"label_total";s:5:"Total";s:8:"use_ajax";s:2:"no";}');
}
add_action('save_post_product', 'my_function', 10);
的自定義後類型(組由WooCommerce)是產品
我似乎無法得到這個火。在創建(不編輯)產品時,我確實設法解決了這個問題,但由於我修改了代碼太多次以便回溯。
我試圖與瞬變,add_post_meta,wp_insert_post等