Missing dependency – Comment-reply
AnonymousJune 5, 2018 at 5:26 pm #49633
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?
AnonymousJune 7, 2018 at 12:43 pm #49644
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.
AnonymousJune 12, 2018 at 11:45 pm #49652
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.Admin
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.
- You must be logged in to reply to this topic.