Title: Exclude posts dynamically / in shortcode?
Last modified: August 30, 2016

---

# Exclude posts dynamically / in shortcode?

 *  Resolved [Kovah](https://wordpress.org/support/users/kovah/)
 * (@kovah)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/exclude-posts-dynamically-in-shortcode/)
 * Hi,
 * at the moment I’m pretty happy with Top 10 but one functionality is missing for
   me.
    Users of my site should be allowed to exclude posts from the trendings but
   they do not have access to the plugin settings. Is there _any_ way to exclude
   posts in the widget or shortcode directly? Or maybe hook into the plugin settings
   and create a new field in the post edit screen or something similar?
 * Thanks for your work!
 * [https://wordpress.org/plugins/top-10/](https://wordpress.org/plugins/top-10/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/exclude-posts-dynamically-in-shortcode/#post-6278467)
 * Hi,
 * It’s one of the things I plan on implementing, i.e. exclusion settings per post
   in the metabox. I’ll need to see how I can implement it partially for admins 
   and partially for all users. But, it’s a good idea that I’ll put on my list of
   things to add.
 *  Thread Starter [Kovah](https://wordpress.org/support/users/kovah/)
 * (@kovah)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/exclude-posts-dynamically-in-shortcode/#post-6278582)
 * Hmm okay but there is no way to do this without changing the plugin code, right?
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/exclude-posts-dynamically-in-shortcode/#post-6278587)
 * Hi,
 * In theory, you could hook into the `'tptn_widget_options` filter to set the option
   to
 * Something like:
 *     ```
       function filter_tptn_widget_options( $arguments ) {
   
           $arguments['exclude_post_ids'] = '10,15';
   
       }
       add_filter( 'tptn_widget_options', 'filter_tptn_widget_options' );
       ```
   
 * Where you set the 10, 15 etc. as a set of post IDs to exclude.
 * If you’re using the shortcode to display the top posts, then you could pass:
 * `exclude_post_ids = '10,15'` as one of the parameters of the shortcode.
 * However, this won’t automatically allow authors to select their post not to display
   in the top lists. It might be more of an admin thing. Alternatively, you could
   code in your custom field / meta and let them select this and then use that to
   populate the list of post IDs that the above parameter takes.
 * This is eventually what I will be implementing.
 *  Thread Starter [Kovah](https://wordpress.org/support/users/kovah/)
 * (@kovah)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/exclude-posts-dynamically-in-shortcode/#post-6278588)
 * Hell it’s that easy!
    Simply adding the `exclude_post_ids="10,15"` to the shortcode
   excluded the posts from the widget! MANY MANY THANKS!
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/exclude-posts-dynamically-in-shortcode/#post-6278590)
 * You’re welcome 🙂 The shortcode is extremely powerful, because you can pass any
   of the default options and it will work.
 * Btw, do consider writing a review of Top 10.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Exclude posts dynamically / in shortcode?’ is closed to new replies.

 * ![](https://ps.w.org/top-10/assets/icon-256x256.png?rev=2986432)
 * [WebberZone Top 10 — Popular Posts](https://wordpress.org/plugins/top-10/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/top-10/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/top-10/)
 * [Active Topics](https://wordpress.org/support/plugin/top-10/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/top-10/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/top-10/reviews/)

## Tags

 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 5 replies
 * 2 participants
 * Last reply from: [Ajay](https://wordpress.org/support/users/ajay/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/exclude-posts-dynamically-in-shortcode/#post-6278590)
 * Status: resolved