//========= Save Post =========== function update_post($post_id) { for ($id = 1; $id <= 50000; $id++) { $post = get_post( $id, ARRAY_A ); if ( 'attachment' == $post['post_type'] ) { $post['post_excerpt'] = 'Style At Home'; $alt = 'Style At Home'; update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) ); wp_update_post( $post ); } } } add_action( 'save_post', 'update_post');
Last updated 3 years ago