Changeset 12371
- Timestamp:
- 01/27/2023 12:42:34 AM (2 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php
r12299 r12371 19 19 add_action( 'add_meta_boxes', __NAMESPACE__ . '\add_meeting_metaboxes' ); 20 20 add_action( 'save_post_lesson-plan', __NAMESPACE__ . '\save_lesson_plan_metabox_fields' ); 21 add_action( 'save_post_wporg_workshop', __NAMESPACE__ . '\save_workshop_meta box_fields' );21 add_action( 'save_post_wporg_workshop', __NAMESPACE__ . '\save_workshop_meta_fields' ); 22 22 add_action( 'save_post_meeting', __NAMESPACE__ . '\save_meeting_metabox_fields' ); 23 23 add_action( 'admin_footer', __NAMESPACE__ . '\render_locales_list' ); … … 470 470 471 471 /** 472 * Update the post meta values from the meta boxfields when the post is saved.472 * Update the post meta values from the meta fields when the post is saved. 473 473 * 474 474 * @param int $post_id 475 475 */ 476 function save_workshop_meta box_fields( $post_id ) {476 function save_workshop_meta_fields( $post_id ) { 477 477 if ( wp_is_post_revision( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) { 478 478 return; … … 521 521 add_post_meta( $post_id, 'other_contributor_wporg_username', $username ); 522 522 } 523 } 524 525 // This language meta field is rendered in the editor sidebar using a PluginDocumentSettingPanel block, 526 // which won't save the field on publish if it has the default value. 527 // Our custom workshops query for locale prioritized tutorials (see functions.php `wporg_archive_query_prioritize_locale`) 528 // depends on it being set, so we force it to be updated after saving: 529 $language = get_post_meta( $post_id, 'language', true ); 530 $language_default = 'en_US'; 531 if ( ! isset( $language ) || $language_default === $language ) { 532 update_post_meta( $post_id, 'language', $language_default ); 523 533 } 524 534 }
Note: See TracChangeset
for help on using the changeset viewer.