Can I display photos from a specific hashtag only from a specific User ID?

Version 2.0 and above

Option 1

You can easily display posts from a User ID or location which contain certain hashtags by using the setting labeled ‘Show photos containing these words or hashtags’ which can be found in the following location: Instagram Feed > Customize > Moderation.  The plugin will then only show posts which contain those words or hashtags.

You can also specify words or hashtags for individual feeds by using the shortcode option; includewords. For example:

[instagram-feed includewords="#sunshine"]

Option 2 (version 2.4 and above)

If your hashtag is fairly unique (most posts to the hashtag come from one account), you can use the “showusers” setting and a hashtag feed to filter posts by the user name of the poster. includewords. For example:

[instagram-feed type=hashtag hashtag="#sunshine" showusers="myUserName"]

Below version 2.0

Instagram’s API doesn’t allow you to retrieve photos which include a specific hashtag only from a specific user, they only allow you to retrieve photos for one or the other. We’ve built a workaround for this into version 2.0 of the plugin, and for lower versions you can use the snippet below to achieve similar functionality. The plugin will retrieve photos from your User ID as usual but then the snippet will only show the ones which include the hashtag that you specify. Add the following to the plugin’s Custom JavaScript section, which is on the plugin’s Customize page:

if( $(this).find('.sbi_photo img').attr('alt').toLowerCase().indexOf("#your_hashtag") < 1 ) $(this).remove();

Replace the #your_hashtag with the hashtag you want to display. This will hide all posts from your User ID which don’t include that hashtag.

Alternatively, if the hashtag is pretty unique and used mainly by your Instagram page then it may work better to show all posts from that hashtag and then hide those that aren’t from your page. So you would need to either set the hashtag on the plugin’s Settings page, or use the following shortcode: [instagram-feed type=hashtag hashtag="#your_hashtag"]. You can then use the following JavaScript snippet instead of the previous one to hide all photos which aren’t from your user:

if( $(this).find('.sbi_username a').text() !== "your_username" ) $(this).remove();

Replace your_username with your username (not your User ID).

Please note: as these snippets will only filter through the posts that the plugin retrieves from Instagram then it’s a good idea to set the number of posts to be higher than normal, as some posts will be filtered out.