Title: [Plugin: Get Posts] When Tag is Empty
Last modified: August 20, 2016

---

# [Plugin: Get Posts] When Tag is Empty

 *  [dotdynamic](https://wordpress.org/support/users/dotdynamic/)
 * (@dotdynamic)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-get-posts-when-tag-is-empty/)
 * Hi,
 * Thanks for the plugin! I’m using it to display contextually relevant posts on
   specific page using the shortcode in combination with the WordPress Text widget.
 * One thing I found was that if no posts were returned I ended up with an empty
   widget box. So in case it helps anyone else:
 * `$posts = get_posts($args);`
 * Below I added:
 *     ```
       if (empty($posts)) {
         $content = $content. "No related posts yet! <a href='blog/'>Take a look at some other blog posts</a>";
       }
       ```
   
 * Cheers,
    Mat
 * [http://wordpress.org/extend/plugins/nurelm-get-posts/](http://wordpress.org/extend/plugins/nurelm-get-posts/)

The topic ‘[Plugin: Get Posts] When Tag is Empty’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/nurelm-get-posts.svg)
 * [Get Posts](https://wordpress.org/plugins/nurelm-get-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nurelm-get-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nurelm-get-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/nurelm-get-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nurelm-get-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nurelm-get-posts/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [dotdynamic](https://wordpress.org/support/users/dotdynamic/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-get-posts-when-tag-is-empty/)
 * Status: not resolved