How to Include or Exclude Images From the WordPress Gallery

How to Include or Exclude Images From the WordPress Gallery

There are many ways that you can customize the native WordPress gallery shortcode. If you just use the gallery shortcode by itself, the default behavior is to include all of the images attached to a post.

But what if you want to limit the gallery to only a few specific images? For example, let’s say you want to show a small gallery of food pictures?

Here’s a couple quick ways to customize the WordPress gallery shortcode.

How to Exclude Specific Images:

If you want to include all images attached to a post, with the exception of a select few, you can use “exclude=” in the shortcode, followed by comma separated attachment IDs: