最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Insert post without actionshooks

programmeradmin2浏览0评论

I am developing a custom importer for WordPress (because we have a very custom setup and the available tools don't seem to work for our scenario).

During this import, I'd like to disable any hooks there are when creating/updating a post. For instance this hook is being fired, and it is generating some errors:

add_action(
    'woocommerce_process_product_meta_simple',
    array( $this, 'on_simple_product_publish' ),
    10,  // Action priority
    1    // Args passed to on_product_publish (should be 'id')
);

add_action(
    'woocommerce_process_product_meta_variable',
    array( $this, 'on_variable_product_publish' ),
    10,  // Action priority
    1    // Args passed to on_product_publish (should be 'id')
);

add_action(
    'woocommerce_process_product_meta_booking',
    array( $this, 'on_simple_product_publish' ),
    10,  // Action priority
    1    // Args passed to on_product_publish (should be 'id')
);

add_action(
    'woocommerce_process_product_meta_external',
    array( $this, 'on_simple_product_publish' ),
    10,  // Action priority
    1    // Args passed to on_product_publish (should be 'id')
);

add_action(
    'woocommerce_process_product_meta_subscription',
    array( $this, 'on_product_publish' ),
    10,  // Action priority
    1    // Args passed to on_product_publish (should be 'id')
);

add_action(
    'woocommerce_process_product_meta_variable-subscription',
    array( $this, 'on_product_publish' ),
    10,  // Action priority
    1    // Args passed to on_product_publish (should be 'id')
);

Is there a way to disable all actions? Or should we run a custom MySQL query to insert into the database instead?

发布评论

评论列表(0)

  1. 暂无评论