ACF Repeater Field Meta Queries

In order to use a meta query to find a value of a post’s repeater field we need to make sure we hook into “posts_where” and swap out a “=” for a “LIKE” so we can find our correct meta keys.

Here is the example code for that.

Now we can just add a meta query to our WP Query args and search our repeater fields like so.


Set Custom Facebook Image in Yoast

Display a custom featured image while using the Yoast WP SEO plugin.


A Better Media Sideload Image

media_sideload_image is a WordPress function I have had to use countless times to upload attachments based on a provided URL. Often from Google Maps, but sometimes just from import scripts pointing to a URL. It has always worked well enough, but it has a couple of issues. The main problem is the lack of an ability to provide a filename separate from the image basename. This was especially ugly when generating static Google Maps…especially after Google Started requiring API keys…which WOULD BE SAVED AS PART THE FILE NAME!!!! Anyway, I looked around for a bit and found a really great solution on WordPress Stack Exchange from user Somatic.

It is a fairly large function so I’ll just provide the link:

Trust me, if you want to use media_sideload_image, use Somatic’s function instead.

Multiple WP Dropdown

Thanks to Stack Exchange user MahdiY!

See original here.

In functions.php

When using wp_dropdown_categories just add the “multiple” argument:



Add Lazy Load and Lity Lightbox to content images

We had a client who has thousands of images in their blog posts over the years.

We needed to make sure all of those images have lazy load and appear in a lightbox when clicked.

Obviously this requires you to install a lazy load plugin and a light box plugin. I recommend these:

Lazy Load:

Lity Lightbox:

Now the code!


Custom Woocommerce ACF Category Filters

We had a client recently that needed to be able to create product filters based on the product categories they were assigned to. This presented a problem because we didn’t want to clog up the taxonomy / category pages with a bunch of filter options and the user also needed to be able to edit these categories in the future.

We took the approach of adding some ACF fields to the product categories and then inserting a meta box on the products based on their selected categories which would list the ACF fields as checkboxes, similar to selecting a taxonomy.

It is hard to explain so here is a bunch of code and images to explain.

Here is our custom meta box displaying the filters that were created in the category page. Notice this is actually displaying the filters from ALL selected categories.
Here are the filters created in one category.
This is what the front end looks like. The checkboxes are FontAwesome icons.

Finally, here is the code needed to accomplish this.

All of this code goes into your “functions.php” file

Here is an example of what the front end HTML might look like.