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

AxeWP / wp-graphql-rank-math / 5243741106

pending completion
5243741106

push

github

web-flow
feat: Add support for Redirections Module (#52)

* feat: add redirection settings

* ...save-progress

* stash changes

* chore: lint

* dev: get single redirection from db directly

* ci: use mariadb 10.x

* dev: fix cursor comparison

* chore: cleanup

* tests: additional pagination tests

* chore: update deps and changelog

454 of 454 new or added lines in 22 files covered. (100.0%)

2490 of 2727 relevant lines covered (91.31%)

10.74 hits per line

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

57.14
/src/CoreSchemaFilters.php
1
<?php
2
/**
3
 * Adds filters that modify core schema.
4
 *
5
 * @package WPGraphQL\RankMath
6
 */
7

8
namespace WPGraphQL\RankMath;
9

10
use WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Interfaces\Registrable;
11

12
/**
13
 * Class - CoreSchemaFilters
14
 */
15
class CoreSchemaFilters implements Registrable {
16
        /**
17
         * {@inheritDoc}
18
         */
19
        public static function init(): void {
20
                add_filter( 'graphql_seo_type_prefix', [ self::class, 'get_type_prefix' ] );
×
21
                add_filter( 'graphql_allowed_fields_on_restricted_type', [ self::class, 'allow_seo_on_post_types' ], 10, 2 );
×
22

23
                // Modules.
24
                Modules\Redirection\CoreSchemaFilters::init();
×
25
        }
26

27
        /**
28
         * Prefixes all plugin GraphQL types.
29
         *
30
         * @param string $type_name the non-prefixed type name.
31
         */
32
        public static function get_type_prefix( string $type_name = null ): string {
33
                return ! empty( $type_name ) ? $type_name : 'RankMath';
18✔
34
        }
35

36
        /**
37
         * Sets seo to return on unauthenticated requests.
38
         *
39
         * @param string[] $allowed_fields .
40
         * @param string   $model_name .
41
         *
42
         * @return string[]
43
         */
44
        public static function allow_seo_on_post_types( array $allowed_fields, string $model_name ): array {
45
                if ( 'PostTypeObject' === $model_name ) {
9✔
46
                        $allowed_fields[] = 'seo';
1✔
47
                }
48

49
                return $allowed_fields;
9✔
50
        }
51
}
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

© 2025 Coveralls, Inc