Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches

You could break apart the search-string into an array and add each word to it’s own meta-query $search_query = ‘strawberries and cream’; $search_query_array = explode(‘ ‘, $search_query); // turn search query string into array of words $stop_words = [‘and’,’or’,’that’,’have’,’with’,’this’]; if ( ! empty( $search_query_array ) ) { foreach( $search_query_array as $index ) { // remove … Read more

Get previous and next custom post by custom field

You should be able to set the orderby value to meta_value_datetime. More info at WordPress: https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters Try this: $args = array( ‘post_type’ => ‘event’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘_start_at’, ‘meta_type’ => ‘DATETIME’, ‘orderby’ => ‘meta_value_datetime’, ‘order’ => ‘ASC’, ); $query = new WP_Query( $args ); Maybe there’s an issue with the date value formatting. … Read more

Update value inside array update_post_meta

The structure of the array you’ve provided suggests that you’re trying to access an incorrect level of the array. Try to replace: $t[0][“_give_amount”] = 25.00; $t[1][“_give_amount”] = 65.00; $t[2][“_give_amount”] = 100.00; $t[3][“_give_amount”] = 250.00; $t[4][“_give_amount”] = 650.00; with: $t[0][0][“_give_amount”] = 25.00; $t[0][1][“_give_amount”] = 65.00; $t[0][2][“_give_amount”] = 100.00; $t[0][3][“_give_amount”] = 250.00; $t[0][4][“_give_amount”] = 650.00;