Plugin Directory

Changeset 2016092


Ignore:
Timestamp:
01/21/2019 08:50:58 AM (7 years ago)
Author:
nikolam
Message:

Fix service type not saving in quickedit

Location:
sermon-manager-for-wordpress/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sermon-manager-for-wordpress/trunk/includes/sm-core-functions.php

    r1986699 r2016092  
    843843 * @param int $post_ID The sermon ID.
    844844 */
    845 function set_service_type( $post_ID ) {
     845function sm_set_service_type( $post_ID ) {
    846846    if ( isset( $_POST['wpfc_service_type'] ) ) {
    847847        $term = get_term_by( 'id', $_POST['wpfc_service_type'], 'wpfc_service_type' );
     
    852852
    853853        wp_set_object_terms( $post_ID, empty( $service_type ) ? null : $service_type, 'wpfc_service_type' );
    854     }
    855 }
    856 
    857 add_action( 'save_post', 'set_service_type', 99 );
     854
     855        return;
     856    }
     857
     858    if ( isset( $_POST['tax_input'] ) && isset( $_POST['tax_input']['wpfc_service_type'] ) && $_POST['tax_input']['wpfc_service_type'] ) {
     859        $terms = explode( ',', $_POST['tax_input']['wpfc_service_type'] );
     860
     861        if ( $terms ) {
     862            $term = get_term_by( 'name', $terms[0], 'wpfc_service_type' );
     863
     864            if ( $term ) {
     865                update_post_meta( $post_ID, 'wpfc_service_type', $term->term_id );
     866            }
     867        }
     868    }
     869}
     870
     871add_action( 'save_post', 'sm_set_service_type' );
    858872
    859873/**
  • sermon-manager-for-wordpress/trunk/readme.txt

    r2013333 r2016092  
    128128* New: Add support for TwentyNineteen
    129129* Change: Add WordPress author metabox
     130* Fix: Service Type not saving in quick edit
    130131
    131132### 2.15.12 ###
Note: See TracChangeset for help on using the changeset viewer.