Using Brevo service on WP Mail SMTP

Brevo (formerly Sendinblue) is one of our recommended mailers in WP Mail SMTP. It’s a transactional email provider with scalable price plans, so it’s suitable for any size of business.

I chose Brevo’s because of its free plan that allows to send up to 300 emails a day. Also, they don’t require to enter my credit card to try it out.

If they perform well and my needs require an upgrade, I can always just switch to a higher plan to increase my sending limits.

All you need to do is generate an API Key and connect it with any plugins that requires email such as forms.

List all posts in custom post type by taxonomy

$args = array('post_type' => 'custom_post_type',
'tax_query' => array(
array(
'taxonomy' => 'custom_taxonomy',
'field' => 'slug',
'terms' => $custom_term->slug,
),
),
);

$loop = new WP_Query($args);
if($loop->have_posts()) {

while($loop->have_posts()) : $loop->the_post();
echo get_the_title();
endwhile;
}

meta_query compare operator explanation

=   equals
!=  does not equal
>   greater than
>=  greater than or equal to
<   less than
<=  less than or equal to

LIKE and NOT LIKE

LIKE and NOT LIKE are SQL operators that let you add in wild-card symbols, so you could have a meta query that looks like this:

array( 
    'key' => 'name', 
    'value' => 'Pat', 
    'compare' => 'LIKE'
)

This would return all posts where the meta value “name” has the string “Pat”. In this case, “Pat” “Patricia” and “Patrick” would all be returned back to you. There’s a non-WordPress tutorial explanation here.

Adding the wildcard character % isn’t necessary, because it gets added by default like @Herb said in his below answer. Like this: $meta_value = '%' . like_escape( $meta_value ) . '%'; – see source.


IN and NOT IN

IN and NOT IN select any matches that are in (or not in) the given array. So you could do something like this:

array(
    'key'     => 'color', 
    'value'   => array('red', 'green', 'blue') 
    'compare' => 'IN'
)

and it would get all posts that have the color set to either red, green, or blue. Using ‘NOT IN’ gets the reverse, any posts that have a value set to anything else than what’s in the array.

The generated SQL for this would look something like this:

SELECT * FROM posts_meta WHERE value IN ("red", "green", "blue") 

BETWEEN and NOT BETWEEN

BETWEEN and NOT BETWEEN allow you to define a range of values that could be correct, and require you to give two values in an array in your meta_query:

array( 
    'key' => 'price', 
    'value' => array(20,30) 
    'compare' => 'BETWEEN'
)

This will get you all posts where the price is between 20 and 30. This person digs into an example with dates.


NOT EXISTS

NOT EXISTS is just like what it sounds – the meta value isn’t set or is set to a null value. All you need for that query is the key and comparison operator:

array( 
    'key' => 'price', 
    'compare' => 'NOT EXISTS'
)

This person needed to query non-existent meta values, and needed them to play nice with others.