Skip to content

Commit

Permalink
Adds ability to also select Readability: No Focus Keyphrase as option.
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsoo committed Nov 18, 2024
1 parent 56fbe7f commit b61c2dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions admin/class-meta-columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ protected function determine_seo_filters( $seo_filter ) {
* @return array The Readability score filter.
*/
protected function determine_readability_filters( $readability_filter ) {
if ( $readability_filter === WPSEO_Rank::NO_FOCUS ) {
return $this->create_no_focus_keyword_filter();
}
$rank = new WPSEO_Rank( $readability_filter );

return $this->create_readability_score_filter( $rank->get_starting_score(), $rank->get_end_score() );
Expand Down
2 changes: 1 addition & 1 deletion inc/class-wpseo-rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public static function get_all_ranks() {
* @return WPSEO_Rank[]
*/
public static function get_all_readability_ranks() {
return array_map( [ 'WPSEO_Rank', 'create_rank' ], [ self::BAD, self::OK, self::GOOD ] );
return array_map( [ 'WPSEO_Rank', 'create_rank' ], [ self::BAD, self::OK, self::GOOD, self::NO_FOCUS ] );
}

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/WP/Admin/Meta_Columns_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,21 @@ public static function determine_readability_filters_dataprovider() {
],
],
],
[
'na',
[
[
'key' => WPSEO_Meta::$meta_prefix . 'meta-robots-noindex',
'value' => 'needs-a-value-anyway',
'compare' => 'NOT EXISTS',
],
[
'key' => WPSEO_Meta::$meta_prefix . 'linkdex',
'value' => 'needs-a-value-anyway',
'compare' => 'NOT EXISTS',
],
],
],
];
}

Expand Down
1 change: 1 addition & 0 deletions tests/WP/Inc/Rank_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public static function provider_get_drop_down_readability_labels() {
[ WPSEO_Rank::BAD, 'Readability: Needs improvement' ],
[ WPSEO_Rank::OK, 'Readability: OK' ],
[ WPSEO_Rank::GOOD, 'Readability: Good' ],
[ WPSEO_Rank::NO_FOCUS, 'Readability: Not analyzed' ],
];
}

Expand Down

0 comments on commit b61c2dc

Please sign in to comment.