mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-02 01:01:18 +03:00
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.
This commit is contained in:
parent
f95a4db541
commit
8d3c495d9b
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue