| @@ -357,8 +357,23 @@ | ||
| 357 | 357 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped in class. |
| 358 | 358 | echo new Meta_Fields_Presenter( $this->get_metabox_post(), 'social' ); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | + $is_block_editor = YoastSEO()->helpers->current_page->is_block_editor(); | |
| 362 | + if ( $is_block_editor && $this->get_metabox_post()->post_type === 'post' ) { | |
| 363 | + /** | |
| 364 | + * Filter: 'wpseo_enable_ai_content_planner_inline_banner' - Allows hiding the AI Content Planner inline banner site-wide. | |
| 365 | + * | |
| 366 | + * Returning false stops the hidden meta inputs from being rendered, which the editor JS treats as "banner disabled". | |
| 367 | + * | |
| 368 | + * @param bool $enabled Whether the inline banner should be available in the editor. Default true. | |
| 369 | + */ | |
| 370 | + if ( apply_filters( 'wpseo_enable_ai_content_planner_inline_banner', true ) ) { | |
| 371 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped in class. | |
| 372 | + echo new Meta_Fields_Presenter( $this->get_metabox_post(), 'content_planner' ); | |
| 373 | + } | |
| 374 | + } | |
| 375 | + | |
| 361 | 376 | /** |
| 362 | 377 | * Filter: 'wpseo_content_meta_section_content' - Allow filtering the metabox content before outputting. |
| 363 | 378 | * |
| 364 | 379 | * @param string $post_content The metabox content string. |
| @@ -728,8 +743,13 @@ | ||
| 728 | 743 | $social_fields, |
| 729 | 744 | WPSEO_Meta::get_meta_field_defs( 'schema', $post->post_type ), |
| 730 | 745 | ); |
| 731 | 746 | |
| 747 | + // We can't detect in save_postdata whether the request is coming from the block editor, so we gate the content_planner fields on post type only. | |
| 748 | + if ( $post->post_type === 'post' ) { | |
| 749 | + $meta_boxes = array_merge( $meta_boxes, WPSEO_Meta::get_meta_field_defs( 'content_planner' ) ); | |
| 750 | + } | |
| 751 | + | |
| 732 | 752 | foreach ( $meta_boxes as $key => $meta_box ) { |
| 733 | 753 | |
| 734 | 754 | // If analysis is disabled remove that analysis score value from the DB. |
| 735 | 755 | if ( $this->is_meta_value_disabled( $key ) ) { |
| @@ -779,9 +799,9 @@ | ||
| 779 | 799 | * |
| 780 | 800 | * @return bool Whether the given meta value key is disabled. |
| 781 | 801 | */ |
| 782 | 802 | public function is_meta_value_disabled( $key ) { |
| 783 | - if ( $key === 'linkdex' && ! $this->seo_analysis->is_enabled() ) { | |
| 803 | + if ( in_array( $key, [ 'linkdex', 'seo_title_score', 'meta_description_score' ], true ) && ! $this->seo_analysis->is_enabled() ) { | |
| 784 | 804 | return true; |
| 785 | 805 | } |
| 786 | 806 | |
| 787 | 807 | if ( $key === 'content_score' && ! $this->readability_analysis->is_enabled() ) { |
| @@ -840,9 +860,9 @@ | ||
| 840 | 860 | $asset_manager->enqueue_style( 'monorepo' ); |
| 841 | 861 | $asset_manager->enqueue_style( 'ai-generator' ); |
| 842 | 862 | $asset_manager->enqueue_style( 'ai-fix-assessments' ); |
| 843 | 863 | |
| 844 | - $is_block_editor = WP_Screen::get()->is_block_editor(); | |
| 864 | + $is_block_editor = YoastSEO()->helpers->current_page->is_block_editor(); | |
| 845 | 865 | $post_edit_handle = 'post-edit'; |
| 846 | 866 | if ( ! $is_block_editor ) { |
| 847 | 867 | $post_edit_handle = 'post-edit-classic'; |
| 848 | 868 | } |