action is not called after a php request

I just solved it! The problem was, that the php request handling works different in wordpress. There has to be a workaround with a admin_post.php hook: Instead of if( isset($_POST[’email’]) && isset($_POST[‘title’]) ){…} I had to use this hook: add_action( ‘admin_post_nopriv_process_form’, ‘process_form_data’ ); add_action( ‘admin_post_process_form’, ‘process_form_data’ ); function process_form_data() { my_function($_POST[’email’],$_POST[‘title’]); wp_redirect($_POST[‘url’]); } A hidden … Read more

Adding Default Settings to Theme My Login plugin

The data wasn’t fully unserialized and properly made as a multidimensional array wp_parse_args() used unnecessarily. get_option() used unnecessarily. function nls_tml_default_settings() { $nlstml = array( ‘enable_css’ => 1, ‘login_type’ => ‘default’, ‘active_modules’ => array( ‘custom-passwords/custom-passwords.php’, ‘custom-user-links/custom-user-links.php’, ‘recaptcha/recaptcha.php’, ‘security/security.php’, ‘themed-profiles/themed-profiles.php’, ‘user-moderation/user-moderation.php’, ), ‘version’ => ‘6.4.10’, ); update_option( ‘theme_my_login’, $nlstml ); $nlsrecap = array( ‘public_key’ => ‘sitekey’, ‘private_key’ … Read more

Write automatic title at save_post (infinite loop)

There is a simple way, You need to use filter hook wp_insert_post_data So the code should be like add_filter( ‘wp_insert_post_data’, ‘set_post_title_with_field_value’ ); function set_post_title_with_field_value( $data ) { if ($data[‘post_type’] == ‘sentence’ ){ $sentence_number = get_field(‘sentencia_no’, $data[‘ID’]); $data[‘post_title’] = $sentence_number; } return $data; } You need to add this code into theme’s functions.php. So try the … Read more

How can I add an additional action button into the woocommerce admin order page?

Add this below code your current active theme functions.php file add_filter( ‘woocommerce_admin_order_actions’, ‘add_custom_order_status_actions_button’, 100, 2 ); function add_custom_order_status_actions_button( $actions, $order ) { if ( $order->has_status( array( ‘processing’ ) ) ) { // The key slug defined for your action button $action_slug = ‘invoice’; $status = $_GET[‘status’]; $order_id = method_exists($the_order, ‘get_id’) ? $the_order->get_id() : $the_order->id; // … Read more

Which hook should I use to capture $_POST(‘password’) via profile update and password reset

Sometimes you have to look at the name of the input you’re trying to pick up via $_POST. It’s not always consistent across forms. In the case of the WooCommerce password change form, the input name for the new password field is ‘password_1’ so that’s what you need to pick up via $_POST: function my_profile_update( … Read more

How can I trigger actions manually?

You are currently using an anonymous function. The first step would be changing it to a named function so you can retrieve it from the wp_filter global array, which holds all the registered actions and filters. You’d do it like this: function payment_test($form, $entry_id){ if ( function_exists( ‘gf_webhooks’ ) ) { $entry = GFAPI::get_entry( $entry_id … Read more