Missing dependency – Comment-reply

  • Anonymous


    Hi there,

    On one of my sites I’m getting an error that there is a missing dependency loading graphene.js – comment-reply.

    I can see in the code that graphene.js is loaded in scripts.php, but I can’t see where you load comment-reply?



    Syahir Hakim


    The comment-reply.js script is only loaded if threaded comment is enabled in WP Admin > Settings > Discussions. We’ll remove this dependency in the next theme update.



    Thanks for the reply, I checked and I had threaded replies set to on, so it should have loaded, but also I set threaded replies to off but no change in the error.



    I scanned my copy of Graphene and could not see where you enqueue comment-reply.js, so I enqueued it myself and the problem went away.


    Syahir Hakim


    In previous version, the line that specifies comment-reply.js as dependency is this:

    wp_enqueue_script( 'graphene', GRAPHENE_ROOTURI . '/js/graphene.js', array( 'bootstrap', 'comment-reply', 'infinite-scroll' ), $version );

    In WordPress, whenever you reply a script as a dependency for another script, that script will automatically be loaded first before the dependent script is loaded. Therefore, there’s no need to have a separate call to queue the dependency scripts, unless those scripts have not been registered yet.

    In the current version, we’ve changed the script loading to this:

    if ( ( get_option( 'thread_comments' ) == 1 ) ) wp_enqueue_script( 'comment-reply' );
    wp_enqueue_script( 'graphene', GRAPHENE_ROOTURI . '/js/graphene.js', array( 'bootstrap', 'infinite-scroll' ), $version );

    In this version, the comment-reply.js will only be loaded if threaded comments is enabled in WordPress discussion settings.

Viewing 5 posts - 1 through 5 (of 5 total)

  • You must be logged in to reply to this topic.