Title: Shortcode hyphen problem
Last modified: August 22, 2016

---

# Shortcode hyphen problem

 *  [gbonvehi](https://wordpress.org/support/users/gbonvehi/)
 * (@gbonvehi)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/shortcode-hyphen-problem/)
 * Forget the problem reported below, it seems the problem is regarding
 *     ```
       add_filter('the_excerpt', array(&$this, 'remove_post_views_count'));
       ```
   
 * I need to see why that is being called since I’m just using the_content.
 * Thanks.
 * ======
    Hi, thanks for the plugin, it’s really helpful.
 * I’m having a specific problem which I can workaround calling the methods directly
   but still should be taken care of anyway.
 * Basically, the shortcode is colliding with others because of what’s explained
   here: [http://codex.wordpress.org/Shortcode_API#Hyphens](http://codex.wordpress.org/Shortcode_API#Hyphens)
   
   Using post_views (changing the hyphen) as shortcode solves it.
 * Cheers,
    Guillermo
 * [https://wordpress.org/plugins/post-views-counter/](https://wordpress.org/plugins/post-views-counter/)

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

 *  Thread Starter [gbonvehi](https://wordpress.org/support/users/gbonvehi/)
 * (@gbonvehi)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/shortcode-hyphen-problem/#post-5363070)
 * Well, after a quick review, I saw that inside *remove_post_views_count* method
   you’re besides removing the tag from the excerpt, also deregistering the shortcode,
   so if in a page you display an excerpt AND a content AFTER it it won’t have the
   shortcode available.
 *     ```
       89     public function remove_post_views_count($excerpt)
        90     {
        91         remove_shortcode('post-views');
        92         $excerpt = preg_replace ('/\[post-views[^\]]*\]/', '', $excerpt);
        93         return $excerpt;
        94     }
       ```
   
 * I’ve removed the remove_shortcode call, I don’t know if that will affect other
   functionality of the plugin (I guess it shouldn’t), so far it seems to be working
   fine.
 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/shortcode-hyphen-problem/#post-5363090)
 * Guillermo, thank you very much for your in-depth analysys of the issue and the
   suggestions.
 * I must admitt, at the time of writing this part of code I was wondering if this
   generates any issues or not. Now I have an answer 🙂
 * I’ll look at that closely before next plugin update.
 * Thanks again,
    Bartosz

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

The topic ‘Shortcode hyphen problem’ is closed to new replies.

 * ![](https://ps.w.org/post-views-counter/assets/icon-256x256.png?rev=2973820)
 * [Post Views Counter](https://wordpress.org/plugins/post-views-counter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-views-counter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-views-counter/)
 * [Active Topics](https://wordpress.org/support/plugin/post-views-counter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-views-counter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-views-counter/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [dFactory](https://wordpress.org/support/users/dfactory/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/shortcode-hyphen-problem/#post-5363090)
 * Status: not resolved