getPrefixedThemePostMetaName( 'cta_option_nonce' ) ] ) ) { return; } if ( ! wp_verify_nonce( $_POST[ ace()->getPrefixedThemePostMetaName( 'cta_option_nonce' ) ], ace()->getPrefixedThemePostMetaName( 'save_to_cta_option' ) ) ) { return; } if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } if ( isset( $_POST['post_type'] ) && 'ace-cta' !== $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) { return; } } else { if ( ! current_user_can( 'edit_post', $post_id ) ) { return; } } if ( ! isset( $_POST[ ace()->getPrefixedThemePostMetaName( 'with_cta' ) ] ) ) { return; } $with_cta = $_POST[ ace()->getPrefixedThemePostMetaName( 'with_cta' ) ]; if ( ! is_array( $with_cta ) || 0 >= count( $with_cta ) ) { return; } // Update $saved_data = []; if ( ! is_array( $with_cta ) || 0 >= count( $with_cta ) ) { return; } foreach ( $with_cta as $key => $value ) { if ( in_array( $key, array( 'id', 'position' ) ) ) { $saved_data[ $key ] = sanitize_text_field( wp_strip_all_tags( $value ) ); } } $saved_data = wp_parse_args( $saved_data, array( 'id' => '0', 'position' => 'after-content', ) ); $saved_data = json_encode( $saved_data, JSON_UNESCAPED_UNICODE ); update_post_meta( $post_id, ace()->getPrefixedThemePostMetaName( 'with_cta' ), $saved_data );