Post Pay Counter

The best way to pay authors on WordPress

  • Features
    • PRO version
  • Cart
    • Addons
  • Documentation
  • Support

Big discrepancy in word count

by

› Forums › Post Pay Counter PRO › Support › Big discrepancy in word count

We are based in Europe with a GMT+1/GMT+2 time zone - support replies may be delayed due to time zone differences with your country.

  • This topic has 12 replies, 2 voices, and was last updated 5 years, 7 months ago by Stefano.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • September 25, 2019 at 3:32 am #67942
    Divya
    Guest

    Hi,

    We installed the pro version of the plugin on our website and noticed a huge discrepancy in the word count. For instance, WordPress says 502 whereas the plugin shows it as 582. Could you fix this problem for us? With such a big deviation, it’s impossible to use the plugin on our site.

    Thanks,
    Divya

    September 25, 2019 at 12:20 pm #67951
    Stefano
    Keymaster

    Hi there,
    Could you link to one example post having the issue, so we can try to reproduce the issue? ๐Ÿ™‚

    Have a nice day,
    Stefano

    September 25, 2019 at 12:31 pm #67954
    Divya
    Guest
    This reply has been marked as private.
    September 25, 2019 at 11:02 pm #67968
    Stefano
    Keymaster

    Uhm, this is difficult to debug, the public content copied-pasted in my local WordPress reports 601 words from WP. Could you maybe copy here the HTML version of the post, taken from the editor?

    September 26, 2019 at 12:06 am #67973
    Divya
    Guest
    This reply has been marked as private.
    September 26, 2019 at 12:10 am #67975
    Divya
    Guest

    I think the plugin is counting the caption tags:

    [caption id="attachment_20637" align="aligncenter" width="586"]. These are all over in the post.

    September 26, 2019 at 11:09 am #67982
    Stefano
    Keymaster

    You are right. I am going to add an option to allow the shortcodes to be applied when words are counted. If you want to test this before release, this is the relevant part of code, starting at line 262 of post-pay-counter/classes/ppc_counting_stuff_class.php:

    //Handle input parameter
            if( is_a( $post, 'WP_Post' ) )
    			$post_content = apply_filters( 'ppc_count_post_words_post_content_start', $post->post_content, $post->ID );
    		else if( is_string( $post ) )
    			$post_content = apply_filters( 'ppc_count_post_words_post_content_start', $post );
    		else
    			return new WP_Error( 'ppc_invalid_argument', 'count_post_words only accepts a WP_post istance or a text string', array( $post ) );
    
    		//Strip tags & content with class="ppc_exclude_words" (doesn't handle nested tags, ie <div class="ppc_exclude_posts">some content <div class="nested">nested content</div> this will already be counted</div>
    		$purged_content = preg_replace( '/<([^>]*) [^>]*class=("|\')ppc_exclude_words("|\')[^>]*>(.*?)<\/\1>/s', '', $post_content );
    
            if( self::$settings['counting_exclude_quotations'] )
                $purged_content = preg_replace( '/<(blockquote|q)>(.*?)<\/(blockquote|q)>/s', '', $purged_content );
    
            if( self::$settings['counting_words_exclude_pre'] )
                $purged_content = preg_replace( '/<(pre)>(.*?)<\/(pre)>/s', '', $purged_content );
    
    		if( ! has_shortcode( $post_content, 'ppc' ) )
    			$purged_content = do_shortcode( $purged_content );
    
    		$purged_content = strip_tags( $purged_content );
    September 26, 2019 at 7:36 pm #67992
    Divya
    Guest

    I see. When will the update be available?

    September 26, 2019 at 9:54 pm #67995
    Stefano
    Keymaster

    I would say no later than saturday, I’ll keep you posted ๐Ÿ™‚

    • This reply was modified 5 years, 7 months ago by Stefano.
    September 28, 2019 at 4:02 am #68027
    Divya
    Guest

    Good to know. Looks like just in time before we rollup and make payment to our authors!

    September 28, 2019 at 11:10 am #68034
    Stefano
    Keymaster

    Just released! It’s a new, opt-in option, you can find it in Options > Counting settings > Words payment.

    Let me know! ๐Ÿ™‚
    Have a nice day,
    Stefano

    September 29, 2019 at 3:17 am #68066
    Divya
    Guest

    It works now! Thanks Stefano.

    September 29, 2019 at 9:42 am #68073
    Stefano
    Keymaster

    Good, super glad to hear that! ๐Ÿ™‚

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Big discrepancy in word count’ is closed to new replies.

Your cart

Number of items in cart: 0

  • Your cart is empty.
  • Total: €0.00
  • Checkout

What are you looking for?

BEFORE POSTING

Before posting, please please please do have a look at our Documentation section. Your problem may be addressed there, allowing you to solve it without help from us :)

Copyright © 2025 ยท Centric Theme on Genesis Framework ยท WordPress ยท Log in