Title: About the shortcode class
Last modified: October 2, 2019

---

# About the shortcode class

 *  [jimihenrik](https://wordpress.org/support/users/jimihenrik/)
 * (@jimihenrik)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/about-the-shortcode-class/)
 * Hey. Was just wondering why on one page it kept forcing out the viewcounts and
   came across this code on the shortcode class on _validate_args()
 *     ```
       if ( isset( $args['showviews'] ) ) { // showviews (true/false - default=false)
       	$args['showviews'] = true;
       } else {
       	$args['showviews'] = false;
       }
       ```
   
 * That’s kinda annoying in the sense that even if you have set showviews=”false”
   it’s still set, and thus this forces it to be true.
 * If you want to handle the default like this I guess something along the lines
   of
 * `if ( isset( $args['showviews'] ) && $args['showviews'] !== false )`
 * would be better.
 * Thanks.

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

 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/about-the-shortcode-class/#post-11990834)
 * Hello [@jimihenrik](https://wordpress.org/support/users/jimihenrik/),
 * You are correct. That way of doing the args validation is not the proper way.
   As you suggested your way is how it should be.
 * We’ve been working on a new version of this plugin for some time already, yet
   our efforts are fully focused on our new hosting product at the moment.
 * Still, you can check out how the new version will work using our Github repository,
   there is even a pre-release version available here: [https://github.com/presslabs/toplytics](https://github.com/presslabs/toplytics)
 *  Thread Starter [jimihenrik](https://wordpress.org/support/users/jimihenrik/)
 * (@jimihenrik)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/about-the-shortcode-class/#post-11992222)
 * I’ll check the github, thanks!

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

The topic ‘About the shortcode class’ is closed to new replies.

 * ![](https://ps.w.org/toplytics/assets/icon-128x128.png?rev=1610348)
 * [Toplytics](https://wordpress.org/plugins/toplytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/toplytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/toplytics/)
 * [Active Topics](https://wordpress.org/support/plugin/toplytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/toplytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/toplytics/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [jimihenrik](https://wordpress.org/support/users/jimihenrik/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/about-the-shortcode-class/#post-11992222)
 * Status: not resolved