Ajax callback not work

The problem is a basic PHP issue, you told WordPress to call a function named get_data_from_form when the wp_ajax_get_data_from_form action happens] add_action(‘wp_ajax_get_data_from_form’, ‘get_data_from_form’ ); But no function with that name exists. Sure you have a class with a function inside it that exists, but that’s not the same. Think of it this way, if there … Read more

How to stop execution of a function via add_action hook?

The usual way to add an action hook is more like this: // … some other code do_action( ‘my_action’, $post_id ); // …elsewhere add_action( ‘my_action’, ‘wpse405965_function’ ); /** * Function hooked to my_action * * @param int $post_id The post ID. */ function wpse405965_function( $post_id ) { if ( 2 !== $post_id ) { echo … Read more