How can i take all ids from untrash_post action?

You can use transition_post_status: add_action(‘transition_post_status’, ‘wpse_handle_untrash’); function wpse_handle_untrash($new_status, $old_status, $post) { // if the post was in the trash, but now is not if($old_status == ‘trash’) { // if you want, you can do something only for a certain post type if($post->post_type == ‘my-desired-post-type’) { // do something echo ‘<script>alert(‘ . $post->ID . ‘);</script>’; } … Read more

Get post attachment with post id

yes use this code here you can get attachment id if(isset($_FILES[‘myimage’]) && ($_FILES[‘myimage’][‘size’] > 0)) { // Get the type of the uploaded file. This is returned as “type/extension” $arr_file_type = wp_check_filetype(basename($_FILES[‘myimage’][‘name’])); $uploaded_file_type = $arr_file_type[‘type’]; // Set an array containing a list of acceptable formats $allowed_file_types = array(‘image/jpg’, ‘image/jpeg’, ‘image/gif’, ‘image/png’); if (in_array($uploaded_file_type, $allowed_file_types)) { … Read more