› 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 6 years, 1 month ago by
Stefano.
-
AuthorPosts
-
September 25, 2019 at 3:32 am #67942
Divya
GuestHi,
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,
DivyaSeptember 25, 2019 at 12:20 pm #67951Stefano
KeymasterHi there,
Could you link to one example post having the issue, so we can try to reproduce the issue? ๐Have a nice day,
StefanoSeptember 25, 2019 at 12:31 pm #67954Divya
GuestThis reply has been marked as private.September 25, 2019 at 11:02 pm #67968Stefano
KeymasterUhm, 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 #67973Divya
GuestThis reply has been marked as private.September 26, 2019 at 12:10 am #67975Divya
GuestI 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 #67982Stefano
KeymasterYou 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 #67992Divya
GuestI see. When will the update be available?
September 26, 2019 at 9:54 pm #67995Stefano
KeymasterI would say no later than saturday, I’ll keep you posted ๐
-
This reply was modified 6 years, 2 months ago by
Stefano.
September 28, 2019 at 4:02 am #68027Divya
GuestGood to know. Looks like just in time before we rollup and make payment to our authors!
September 28, 2019 at 11:10 am #68034Stefano
KeymasterJust 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,
StefanoSeptember 29, 2019 at 3:17 am #68066Divya
GuestIt works now! Thanks Stefano.
September 29, 2019 at 9:42 am #68073Stefano
KeymasterGood, super glad to hear that! ๐
-
This reply was modified 6 years, 2 months ago by
-
AuthorPosts
- The topic ‘Big discrepancy in word count’ is closed to new replies.