Inventory_Presser_Contact_Form_7::extract_post_id_from_value( $value )
Source Source
File: includes/integrations/class-contact-form-7.php
protected function extract_post_id_from_value( $value ) { //submitted "2020 Toyota Sienna LE, 10329A" $pieces = explode( ', ', $value ); if ( 1 == sizeof( $pieces ) ) { //delimiter not found return ''; } $stock_number = $pieces[sizeof( $pieces )-1]; $post_ids = get_posts( array( 'fields' => 'ids', 'meta_key' => apply_filters( 'invp_prefix_meta_key', 'stock_number' ), 'meta_value' => $stock_number, 'post_status' => 'publish', 'post_type' => INVP::POST_TYPE, 'posts_per_page' => 1, ) ); if ( empty( $post_ids ) || ! is_array( $post_ids ) ) { return ''; } return $post_ids[0]; }
Expand full source code Collapse full source code View on Github