| @@ -53,9 +53,9 @@ | ||
| 53 | 53 | return $this->inject_bulk_actions($bulk_actions, $post_type); |
| 54 | 54 | }); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - add_action('admin_footer', [$this, 'bulk_action_footer_script']); | |
| 57 | + add_action('admin_enqueue_scripts', [$this, 'bulk_action_footer_script']); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Inject ThinkRank bulk actions |
| @@ -90,10 +90,14 @@ | ||
| 90 | 90 | return array_merge($bulk_actions, $new_actions); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | - * Footer Script to Disable Separator | |
| 95 | - * | |
| 94 | + * Disable the "separator" bulk action option on post-list screens. | |
| 95 | + * | |
| 96 | + * Registered on admin_enqueue_scripts and attached as an inline script to the | |
| 97 | + * core jQuery handle (rather than echoing a raw <script> in admin_footer) so it | |
| 98 | + * passes Plugin Check's inline-script rule. | |
| 99 | + * | |
| 96 | 100 | * @since 1.1.0 |
| 97 | 101 | * @return void |
| 98 | 102 | */ |
| 99 | 103 | public function bulk_action_footer_script(): void { |
| @@ -102,13 +106,11 @@ | ||
| 102 | 106 | if (!$screen || $screen->base !== 'edit') { |
| 103 | 107 | return; |
| 104 | 108 | } |
| 105 | 109 | |
| 106 | -?> | |
| 107 | - <script> | |
| 108 | - jQuery(document).ready(function($) { | |
| 109 | - $('option[value="thinkrank_separator"]').attr('disabled', 'disabled'); | |
| 110 | - }); | |
| 111 | - </script> | |
| 112 | -<?php | |
| 110 | + wp_enqueue_script('jquery'); | |
| 111 | + wp_add_inline_script( | |
| 112 | + 'jquery', | |
| 113 | + 'jQuery(function($){ $(\'option[value="thinkrank_separator"]\').prop(\'disabled\', true); });' | |
| 114 | + ); | |
| 113 | 115 | } |
| 114 | 116 | } |