Title: view count error
Last modified: September 6, 2023

---

# view count error

 *  Resolved [userlogout](https://wordpress.org/support/users/cheon123/)
 * (@cheon123)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/)
 * Hi. I’m using your product well.
   But there was a problem all of a problem.The
   counter’s not workingAs I searched, there was a problem here.What should I do?
   I’ll ask for your help
 * > [View post on imgur.com](https://imgur.com/Yozeg8Y)

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

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17029954)
 * Hi [@cheon123](https://wordpress.org/support/users/cheon123/),
 * Looks like you haven’t set up your Permalink structure yet.
 * Go to **Settings > Permalinks** and under **Common Settings** make sure to select
   either of the Permalink structure options except for the “Plain” one, then save
   changes and check again.
 * ![](https://i0.wp.com/i.postimg.cc/D0nPkzcw/wordpress-permalink-structure-options.
   png?ssl=1)
 * If the issue persists even after setting your Permalink structure then please
   enable the [Debug Log feature](https://i.postimg.cc/D0nPkzcw/wordpress-permalink-structure-options.png)
   and share the contents of your debug.log file (/wp-content/debug.log) here so
   I can have a look.
 *  Thread Starter [userlogout](https://wordpress.org/support/users/cheon123/)
 * (@cheon123)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17034573)
 * HI!! Thank you!!
   But… same error..
 * [https://imgur.com/tCLZ7CR](https://imgur.com/tCLZ7CR)
 * 
   Permalinks change. but same error.. hm.. help me please~!!!
 * Ah!! debug log.
 * [08-Sep-2023 02:07:48 UTC] PHP Notice: Function register_sidebar was called **
   incorrectly**. No `id` was set in the arguments array for the “” sidebar. Defaulting
   to “”. Manually set the `id` to “” to silence this notice and keep existing sidebar
   content. Please see [Debugging in WordPress](https://wordpress.org/documentation/article/debugging-in-wordpress/)
   for more information. (This message was added in version 4.2.0.) in C:\xampp\
   htdocs\wp\wp-includes\functions.php on line 5905
 * functions.php on line 5905..
   `E_USER_NOTICE` <- this.
 *     ```wp-block-code
       if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function_name, $message, $version ) ) {
           if ( function_exists( '__' ) ) {
               if ( $version ) {
                   /* translators: %s: Version number. */
                   $version = sprintf( __( '(This message was added in version %s.)' ), $version );
               }
   
               $message .= ' ' . sprintf(
                   /* translators: %s: Documentation URL. */
                   __( 'Please see <a href="%s">Debugging in WordPress</a> for more information.' ),
                   __( 'https://wordpress.org/documentation/article/debugging-in-wordpress/' )
               );
   
               trigger_error(
                   sprintf(
                       /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
                       __( 'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s' ),
                       $function_name,
                       $message,
                       $version
                   ),
                   E_USER_NOTICE
               );
           } else {
       ```
   
    -  This reply was modified 2 years, 9 months ago by [userlogout](https://wordpress.org/support/users/cheon123/).
    -  This reply was modified 2 years, 9 months ago by [userlogout](https://wordpress.org/support/users/cheon123/).
    -  This reply was modified 2 years, 9 months ago by [userlogout](https://wordpress.org/support/users/cheon123/).
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17034618)
 * Hi [@cheon123](https://wordpress.org/support/users/cheon123/),
 * At first flance it looks like there are a couple of things wrong with your site,
   however since you pasted the contents of your debug.log file here everything 
   got mangled up and is not really readable.
 * Please use [https://pastebin.com/](https://pastebin.com/) to upload the contents
   of your debug.log file and then share the link here so I can have a look.
 *  Thread Starter [userlogout](https://wordpress.org/support/users/cheon123/)
 * (@cheon123)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17034722)
 * Ah.. Sorry..
 * [https://pastebin.com/FD5AgPw5](https://pastebin.com/FD5AgPw5) — wordpress debug
 * [https://pastebin.com/GUVJaqdL](https://pastebin.com/GUVJaqdL) — WordPress Popular
   Posts debug
 * upload!!
    -  This reply was modified 2 years, 9 months ago by [userlogout](https://wordpress.org/support/users/cheon123/).
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17035599)
 * Hey there,
 * Thanks for the logs. I don’t see anything related to WordPress Popular Posts 
   on the first one so that’s good (these PHP notices are coming from your “Presso”
   theme though, so make sure to fix those).
 * From the second log, I’d say that the issue may be related to WP Optimize. Try
   disabling it first and see if the issue goes away. If it does then you know that
   there’s some setting you enabled there that’s conflicting with WordPress Popular
   Posts.
 * If the issue persists even after disabling WP Optimize please try following these
   [troubleshooting instructions](https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#initial-troubleshooting)
   and report back your results.
 *  Thread Starter [userlogout](https://wordpress.org/support/users/cheon123/)
 * (@cheon123)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17039802)
 * Thank you!
 * I deleted all the plug-ins
   And yet the same error occursThere seems to be a theme
   and an error.
 * > [View post on imgur.com](https://imgur.com/mIEC6Im)
 * ———————
 * Whoops. A strange thing happened.
   I modified the code like this and it was processed
   normally.Do you know what’s going on?[https://pastebin.com/WLapFByB](https://pastebin.com/WLapFByB)
    -  This reply was modified 2 years, 9 months ago by [userlogout](https://wordpress.org/support/users/cheon123/).
 *  Thread Starter [userlogout](https://wordpress.org/support/users/cheon123/)
 * (@cheon123)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17039811)
 *     ```wp-block-code
           public function convert_inline_js_into_json(string $tag, string $handle, string $src)
           {
               if ( 'wpp-js' === $handle ) {
                   // id attribute found, replace it
                   if ( false !== strpos($tag, 'wpp-js-js-before') ) {
                       $tag = str_replace('wpp-js-js-before', 'wpp-json', $tag);
       /* -- Add code -- */
                       $pos = strpos($tag, '>');
                       $tag = substr_replace($tag, ' type="application/json">', $pos, 1);
                   } // id attribute missing, let's add it
                   else {
                       $pos = strpos($tag, '>');
                       $tag = substr_replace($tag, ' id="wpp-json">', $pos, 1);
                   }
   
       /* --  commenting out -- */
       //            // type attribute found, replace it
       //            if ( false !== strpos($tag, 'type') ) {
       //                $pos = strpos($tag, 'text/javascript');
       //
       //                if ( false !== $pos ) {
       //                    $tag = substr_replace($tag, 'application/json', $pos, strlen('text/javascript'));
       //                }
       //            } // type attribute missing, let's add it
       //            else {
       //                $pos = strpos($tag, '>');
       //                $tag = substr_replace($tag, ' type="application/json">', $pos, 1);
       //            }
               }
               return $tag;
           }
       ```
   
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17039951)
 * Seems like a problem caused by your WordPress theme. I can’t replicate it with
   any of the Twenty-something themes that I have installed on my site.
 * Which theme are you using now? Is it a custom one or a theme you downloaded from
   somewhere?
 *  Thread Starter [userlogout](https://wordpress.org/support/users/cheon123/)
 * (@cheon123)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17040038)
 * The theme you’re using is..
   **Presso Version: 4.0.7**It is.Anyway, it’s been 
   processed, but I wonder why you modified that code.
    -  This reply was modified 2 years, 9 months ago by [userlogout](https://wordpress.org/support/users/cheon123/).
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17041184)
 * It’s so WordPress Popular Posts can load its popular post list and update views
   count via AJAX. Without that the plugin won’t be able to work as intended. And
   that code isn’t new either, it’s been there since plugin version [5.2.3](https://github.com/cabrerahector/wordpress-popular-posts/compare/5.2.2...5.2.3)(
   released on August 2020).

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

The topic ‘view count error’ is closed to new replies.

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

 * 10 replies
 * 2 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/view-count-error/#post-17041184)
 * Status: resolved