admin管理员组

文章数量:1391995

I have a custom checkbox field on the general settings of my Woocommerce products.

I also have 5 or so functions that all do what I want them to do. These are currently housed in my child theme's functions.php file.

I would like to have it so, once the checkbox is checked on the Product Admin Page and it is saved... all of those functions now become active and affect only the said product.

Is there an easier, quick way of doing this rather than adding the condition if ( 'yes' == $custom_field && $otherstuff ) on every single function manually?

I have a custom checkbox field on the general settings of my Woocommerce products.

I also have 5 or so functions that all do what I want them to do. These are currently housed in my child theme's functions.php file.

I would like to have it so, once the checkbox is checked on the Product Admin Page and it is saved... all of those functions now become active and affect only the said product.

Is there an easier, quick way of doing this rather than adding the condition if ( 'yes' == $custom_field && $otherstuff ) on every single function manually?

Share Improve this question asked Apr 12, 2020 at 16:35 Chaz PierceChaz Pierce 112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0
function start_all(){
    $option = get_option($name);
    if ( 'yes' == $custom_field && $otherstuff ){
         function_1();
         function_2();
         function_3();
    }

}

plase it in functions and call whit hook you need - this is just an example

本文标签: pluginsEasiest way to loadfire a handful of functionsIF checkbox is checked