• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 08ebd1f415cb19b473e076df59deca4d8e2fa445

03 Jun 2026 10:17AM UTC coverage: 53.742% (-4.1%) from 57.809%
08ebd1f415cb19b473e076df59deca4d8e2fa445

Pull #23324

github

web-flow
Merge 2e7c2bfd4 into 8774be1c9
Pull Request #23324: Decouple the block editor sidebar from the metabox hidden fields

9956 of 18388 branches covered (54.14%)

Branch coverage included in aggregate %.

53 of 389 new or added lines in 16 files covered. (13.62%)

10 existing lines in 3 files now uncovered.

37624 of 70146 relevant lines covered (53.64%)

42894.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/integrations/estimated-reading-time.php
1
<?php
2

3
namespace Yoast\WP\SEO\Integrations;
4

5
use Yoast\WP\SEO\Conditionals\Admin\Estimated_Reading_Time_Conditional;
6
use Yoast\WP\SEO\Conditionals\Admin\Post_Conditional;
7

8
/**
9
 * Estimated reading time class.
10
 */
11
class Estimated_Reading_Time implements Integration_Interface {
12

13
        /**
14
         * The Estimated Reading Time Conditional.
15
         *
16
         * @var Estimated_Reading_Time_Conditional
17
         */
18
        protected $conditional;
19

20
        /**
21
         * Constructs the Estimated Reading Time integration.
22
         *
23
         * @param Estimated_Reading_Time_Conditional $conditional The estimated reading time conditional.
24
         */
NEW
25
        public function __construct( Estimated_Reading_Time_Conditional $conditional ) {
×
NEW
26
                $this->conditional = $conditional;
×
27
        }
28

29
        /**
30
         * Returns the conditionals based in which this loadable should be active.
31
         *
32
         * @return array<string> The conditionals.
33
         */
34
        public static function get_conditionals() {
2✔
35
                return [ Post_Conditional::class ];
2✔
36
        }
37

38
        /**
39
         * Initializes the integration.
40
         *
41
         * This is the place to register hooks and filters.
42
         *
43
         * @return void
44
         */
45
        public function register_hooks() {
2✔
46
                \add_filter( 'wpseo_metabox_entries_general', [ $this, 'remove_estimated_reading_time_hidden_fields' ] );
2✔
47
        }
48

49
        /**
50
         * Adds or removes the estimated-reading-time hidden field.
51
         *
52
         * When the estimated reading time conditional is met the field is added.
53
         * When it is not met the field is removed, so it does not show up in the metabox
54
         * even though the meta key is always registered in $meta_fields.
55
         *
56
         * @deprecated 27.9
57
         * @codeCoverageIgnore
58
         * @param array<string, array<string, string|int|string[]>> $field_defs The $fields_defs.
59
         *
60
         * @return array<string, array<string, string|int|string[]>>
61
         */
62
        public function add_estimated_reading_time_hidden_fields( $field_defs ) {
63
                \_deprecated_function( __METHOD__, 'Yoast SEO 27.9' );
64
                return $field_defs;
65
        }
66

67
        /**
68
         * Removes the estimated-reading-time hidden field.
69
         *
70
         * When the estimated reading time conditional is not met the field is removed from hidden fields.
71
         * But the field is registered by default.
72
         *
73
         * @param array<string, array<string, string|int|string[]>> $field_defs Metabox form field definitions, keyed by field name.
74
         *
75
         * @return array<string, array<string, string|int|string[]>>
76
         */
77
        public function remove_estimated_reading_time_hidden_fields( $field_defs ) {
6✔
78
                if ( ! \is_array( $field_defs ) ) {
6✔
79
                        return $field_defs;
2✔
80
                }
81

82
                if ( ! $this->conditional->is_met() ) {
4✔
83
                        unset( $field_defs['estimated-reading-time-minutes'] );
2✔
84
                }
85

86
                return $field_defs;
4✔
87
        }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc