$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>woocommerce offtopic - How can I locate where the actions are defined?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

woocommerce offtopic - How can I locate where the actions are defined?

matteradmin7PV0评论
This question already has answers here: Get a list of all registered actions (2 answers) Closed 6 years ago.

Given the following code:

<form>
    <h1> My form <h1>
    <input type="text" />
    <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
</form>

How can I locate the "woocomerce_checkout_after_customer_details" defined?

It prints a button where I have to add functionality, maybe can I just use add_action() to add new features? in that case: how can I use remove_action() to stop rendering the old button?

Thanks in advance

This question already has answers here: Get a list of all registered actions (2 answers) Closed 6 years ago.

Given the following code:

<form>
    <h1> My form <h1>
    <input type="text" />
    <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
</form>

How can I locate the "woocomerce_checkout_after_customer_details" defined?

It prints a button where I have to add functionality, maybe can I just use add_action() to add new features? in that case: how can I use remove_action() to stop rendering the old button?

Thanks in advance

Share Improve this question edited Nov 23, 2018 at 9:49 Krzysiek Dróżdż 25.6k9 gold badges53 silver badges74 bronze badges asked Nov 23, 2018 at 9:31 JnewbieJnewbie 132 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

You can find out what actions are assigned to given hook with this code:

function print_filters_for( $hook = '' ) {
    global $wp_filter;
    if( empty( $hook ) || ! array_key_exists( $hook, $wp_filter ) ) {
        return;
    }

    print '<pre>';
    print_r( $wp_filter[$hook] );
    print '</pre>';
}

Call it where you need it. In your case:

<form>
    <h1> My form <h1>
    <input type="text" />
    <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
    print_filters_for( 'woocommerce_checkout_after_customer_details' );
</form>
Post a comment

comment list (0)

  1. No comments so far