PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
jetpack / extensions / plugins / seo / seo.php

seo.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-beta, at extensions/plugins/seo/seo.php

67 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Block Editor - SEO feature.
4 *
5 * @package automattic/jetpack
6 */
7
8 namespace Automattic\Jetpack\Extensions\Seo;
9
10 use Automattic\Jetpack\Modules;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit( 0 );
14 }
15
16 add_action(
17 'jetpack_register_gutenberg_extensions',
18 function () {
19 if ( is_seo_disabled() ) {
20 return;
21 }
22
23 \Jetpack_Gutenberg::set_availability_for_plan( 'advanced-seo' );
24 }
25 );
26
27 /**
28 * We only want to enable the SEO extension (and display SEO settings)
29 * if the 'jetpack_disable_seo_tools' filter is not set to false.
30 *
31 * This is done on after_setup_theme to ensure that we have access to the hook
32 * that is used by SEO plugins to disable the conflicting output of SEO Tools.
33 */
34 add_action(
35 'after_setup_theme',
36 function () {
37 if (
38 ! is_seo_disabled()
39 /** This filter is already documented in modules/seo-tools/class-jetpack-seo-utils.php */
40 && ! apply_filters( 'jetpack_disable_seo_tools', false )
41 ) {
42 \Jetpack_Gutenberg::set_extension_available( 'jetpack-seo' );
43 }
44 }
45 );
46
47 add_filter(
48 'jetpack_set_available_extensions',
49 function ( $extensions ) {
50 return array_merge(
51 (array) $extensions,
52 array( 'advanced-seo' )
53 );
54 }
55 );
56
57 /**
58 * SEO tools should be hidden from non-admins if the module is not active.
59 *
60 * @since 14.6
61 *
62 * @return bool
63 */
64 function is_seo_disabled(): bool {
65 return ! ( new Modules() )->is_active( 'seo-tools' ) && ! current_user_can( 'jetpack_activate_modules' );
66 }
67