Can’t get ID of post that relates to the comment

comment_post hook pass to attached functions 3 parameters. The fourth parameter of add_action() indicates to how many parameters the attached function will be able to access. add_action( ‘comment_post’, ‘save_chbox_in_db’, 10, 3 ); function save_chbox_in_db( $comment_ID, $comment_approved, $commentdata ) { $post_id = (int)$commentdata[‘comment_post_ID’]; // // other code // }

add_action doesn’t work for my function

HI please check below code. add_action( ‘user_register’, ‘fill_identity’, 10, 1 ); function fill_identity($user_id){ $current_user = get_userdata($user_id); $mail_user = $current_user->user_email; $mail_user = substr($mail_user,0,-14); $mail_user = explode(“.”, $mail_user); $prenom = $mail_user[0] = ucfirst($mail_user[0]); $nom = $mail_user[1] = ucfirst($mail_user[1]); var_dump($mail_user); wp_update_user(array( ‘ID’ => $current_user->ID, ‘first_name’ => $prenom, ‘last_name’ => $nom, )); }

Updating a related post’s “post_modified” value

Had a brainwave whilst typing up the question.. there are other actions that fire when a post is updated, such as post_updated which naturally update the post_modified timestamp. Instead I decided to save the activity’s modified time as a meta value, and will sort on that instead and leave the post_modified functionality intact. The trimmed … Read more

do_action not working in loop

You are calling do_action before adding it. Move add_action up, before HTML part. Second, your action function ltc_generate_input_fields’ expects$fieldsvalue, however yourdo_action` does not pass this parameter, so change it to do_action($section_actions, $fields);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)