From 8d3c495d9b9bab580b25e00f0d7a9221d65244f0 Mon Sep 17 00:00:00 2001 From: Corey McKrill <916023+coreymckrill@users.noreply.github.com> Date: Fri, 18 Oct 2019 16:42:50 -0700 Subject: [PATCH] Pledge Meta: Update post title when `org-name` gets updated The value in the `org-name` field is also used as the title of the pledge post. If this value changes (via the Manage Pledge form, for example), the post title should be updated as well. There won't be any public way to change the post title directly, so we shouldn't need to implement an auto-update of the post meta value. --- plugins/wporg-5ftf/includes/pledge-meta.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/wporg-5ftf/includes/pledge-meta.php b/plugins/wporg-5ftf/includes/pledge-meta.php index 792130f..a0c6194 100755 --- a/plugins/wporg-5ftf/includes/pledge-meta.php +++ b/plugins/wporg-5ftf/includes/pledge-meta.php @@ -252,6 +252,14 @@ function update_generated_meta( $meta_id, $object_id, $meta_key, $_meta_value ) } switch ( $meta_key ) { + case META_PREFIX . 'org-name': + if ( 'updated_postmeta' === current_action() ) { + wp_update_post( array( + 'post_title' => $_meta_value, + ) ); + } + break; + case META_PREFIX . 'org-url': $domain = get_normalized_domain_from_url( $_meta_value ); update_post_meta( $object_id, META_PREFIX . 'org-domain', $domain );