Spin up a test site of the plugin.
Ajaxify Comments allows you to post comments without a page reload. As a bonus, error messages that normally require a page reload for the user are also inline.
Ajaxify Comments dispatches lifecycle events on document. These events do not require the corresponding callback setting to be configured.
Use wpacAfterUpdateComments to initialize functionality after the comments and comment form have been replaced. It runs after comment submission, pagination, lazy loading, and automatic or manual refreshes.
document.addEventListener( 'wpacAfterUpdateComments', function( event ) {
const { commentUrl, newDom } = event.detail;
// Initialize functionality for the updated comments.
} );Use wpacAfterPostComment when the server has accepted a submitted comment but before the comments are replaced. Its event detail contains commentUrl and the unapproved moderation status.
Both events can also be handled through jQuery. Access their details through event.originalEvent.detail:
jQuery( document ).on( 'wpacAfterUpdateComments', function( event ) {
const { commentUrl, newDom } = event.originalEvent.detail;
} );This project was created and is maintained with aidevops.sh.
