| @@ -44,27 +44,9 @@ | ||
| 44 | 44 | ]; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function render( $attributes, $content ) { |
| 48 | - // Check if post is password protected and user hasn't provided correct password | |
| 49 | - // Skip check in editor mode | |
| 50 | - if ( ! $this->is_editor_mode() && post_password_required() ) { | |
| 51 | - // Don't show ToC for password-protected posts until password is provided | |
| 52 | - return ''; | |
| 53 | - } | |
| 54 | - | |
| 55 | 48 | $this->views( 'widgets/toc' ); |
| 56 | - } | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * Check if we're in editor mode | |
| 60 | - * | |
| 61 | - * @return bool | |
| 62 | - */ | |
| 63 | - private function is_editor_mode() { | |
| 64 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- REST request context check. | |
| 65 | - $context = isset( $_REQUEST['context'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['context'] ) ) : ''; | |
| 66 | - return defined( 'REST_REQUEST' ) && REST_REQUEST && 'edit' === $context; | |
| 67 | 49 | } |
| 68 | 50 | |
| 69 | 51 | public function view_params() { |
| 70 | 52 | $htags = []; |