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

Yoast / wordpress-seo / 0d17440f3bae419b0309677152abfeaa8a619c39

29 Sep 2025 12:31PM UTC coverage: 53.216% (-0.02%) from 53.233%
0d17440f3bae419b0309677152abfeaa8a619c39

Pull #22606

github

web-flow
Merge 560b3ba26 into 8f5eaca29
Pull Request #22606: Add redirection tools page

8388 of 15525 branches covered (54.03%)

Branch coverage included in aggregate %.

0 of 24 new or added lines in 3 files covered. (0.0%)

1 existing line in 1 file now uncovered.

31767 of 59931 relevant lines covered (53.01%)

39846.88 hits per line

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

92.86
/src/integrations/admin/redirect-integration.php
1
<?php
2

3
namespace Yoast\WP\SEO\Integrations\Admin;
4

5
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
6
use Yoast\WP\SEO\Helpers\Redirect_Helper;
7
use Yoast\WP\SEO\Integrations\Integration_Interface;
8

9
/**
10
 * Class Redirect_Integration.
11
 */
12
class Redirect_Integration implements Integration_Interface {
13

14
        /**
15
         * The redirect helper.
16
         *
17
         * @var Redirect_Helper
18
         */
19
        private $redirect;
20

21
        /**
22
         * Sets the helpers.
23
         *
24
         * @param Redirect_Helper $redirect The redirect helper.
25
         */
26
        public function __construct( Redirect_Helper $redirect ) {
2✔
27
                $this->redirect = $redirect;
2✔
28
        }
29

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

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

50
        /**
51
         * Redirect to new settings URLs. We're adding this, so that not-updated add-ons don't point to non-existent pages.
52
         *
53
         * @return void
54
         */
55
        public function old_settings_redirect() {
4✔
56
                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
57
                if ( ! isset( $_GET['page'] ) ) {
4✔
UNCOV
58
                        return;
×
59
                }
60
                // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
61
                $current_page = \sanitize_text_field( \wp_unslash( $_GET['page'] ) );
4✔
62

63
                switch ( $current_page ) {
64
                        case 'wpseo_titles':
4✔
65
                                $this->redirect->do_safe_redirect( \admin_url( 'admin.php?page=wpseo_page_settings#/site-representation' ), 301 );
2✔
66
                                return;
2✔
67
                        default:
68
                                return;
2✔
69
                }
70
        }
71
}
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