Fix comment form Stimulus controller for LiteSpeed
Only relevant if logged-in users are severed cached files and not loaded via AJAX.
This commit is contained in:
parent
b0d4dc8e0c
commit
67cc797010
@ -276,6 +276,7 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
|
||||
| `admin_post_*` | `fictioneer_delete_all_epubs` (10), `fictioneer_tools_add_moderator_role` (10), `fictioneer_tools_move_story_tags_to_genres` (10), `fictioneer_tools_duplicate_story_tags_to_genres` (10), `fictioneer_tools_purge_theme_caches` (10), `fictioneer_tools_move_chapter_tags_to_genres` (10), `fictioneer_tools_duplicate_chapter_tags_to_genres` (10), `fictioneer_tools_append_default_genres` (10), `fictioneer_tools_append_default_tags` (10), `fictioneer_tools_remove_unused_tags` (10), `fictioneer_tools_reset_post_relationship_registry` (10), `fictioneer_admin_profile_unset_oauth` (10), `fictioneer_admin_profile_clear_data_node` (10), `fictioneer_update_frontend_profile` (10), `fictioneer_cancel_frontend_email_change` (10), `fictioneer_add_role` (10), `fictioneer_remove_role` (10), `fictioneer_rename_role` (10), `fictioneer_connection_get_patreon_tiers` (10), `fictioneer_connection_delete_patreon_tiers` (10)
|
||||
| `after_setup_theme` | `fictioneer_theme_setup` (10)
|
||||
| `bulk_edit_custom_box` | `fictioneer_add_patreon_bulk_edit_tiers` (10), `fictioneer_add_patreon_bulk_edit_amount` (10)
|
||||
| `comment_form_top` | `fictioneer_fix_comment_form_stimulus_controller` (10)
|
||||
| `comment_post` | `fictioneer_comment_post` (20), `fictioneer_post_comment_to_discord` (99)
|
||||
| `current_screen` | `fictioneer_restrict_admin_only_pages` (10), `fictioneer_restrict_comment_edit` (10)
|
||||
| `customize_controls_enqueue_scripts` | `fictioneer_enqueue_customizer_scripts` (10)
|
||||
|
@ -21,6 +21,33 @@ if ( ! function_exists( 'fictioneer_comment_form' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some cache plugins need the controller added after loading
|
||||
*
|
||||
* @since 5.27.1
|
||||
*/
|
||||
|
||||
function fictioneer_fix_comment_form_stimulus_controller() {
|
||||
wp_print_inline_script_tag(
|
||||
'(()=>{let e=document.getElementById("commentform");if(e){let t="fictioneer-comment-form",l=e.dataset.controller||"";l.split(" ").includes(t)||(e.dataset.controller=l+(l?" ":"")+t)}})();',
|
||||
array(
|
||||
'id' => 'fictioneer-fix-comment-form-controller-scripts',
|
||||
'type' => 'text/javascript',
|
||||
'data-jetpack-boost' => 'ignore',
|
||||
'data-no-optimize' => '1',
|
||||
'data-no-defer' => '1',
|
||||
'data-no-minify' => '1'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
! get_option( 'fictioneer_enable_ajax_comment_form' ) &&
|
||||
! get_option( 'fictioneer_enable_ajax_comments' )
|
||||
) {
|
||||
add_action( 'comment_form_top', 'fictioneer_fix_comment_form_stimulus_controller' );
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// COMMENT TOOLBAR
|
||||
// =============================================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user