WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Uncaught ReferenceError: current_rating is not defined

[Resolved] Uncaught ReferenceError: current_rating is not defined

Viewing 2 replies - 1 through 2 (of 2 total)
  • Atul
    Member

    @atul1280

    Make sure you have <?php wp_footer(); ?> before the </body> tag.

    miguelsaddress
    Member

    @miguelsaddress

    Thank you, I couldn’t understand what you meant 😀

    In case somebody will come back here to check this problem, I will try to tell what happened.

    The javascript is loaded in the footer because it enqueues the script like this:

    wp_enqueue_script('wp-postratings', plugins_url('wp-postratings/postratings-js.js'), array('jquery'), '1.63', true);

    The last “true” argument indicates so.

    In order to be loaded in the footer, it needs a hook to grab… that hook is what atul1280 mentions, the “wp_footer()” hook.

    When that function executes, it runs everything what is hooked on it, in this case, the javascript code of the rating plugin.

    In my case, I didn’t have the piece of code…

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Uncaught ReferenceError: current_rating is not defined’ is closed to new replies.