PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.1
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.1
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / integrations / abstract-exclude-post-type.php

abstract-exclude-post-type.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.1, at src/integrations/abstract-exclude-post-type.php

47 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Integrations;
4
5 /**
6 * Abstract class for excluding certain post types from being indexed.
7 *
8 * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
9 */
10 abstract class Abstract_Exclude_Post_Type implements Integration_Interface {
11
12 /**
13 * Initializes the integration.
14 */
15 public function register_hooks() {
16 \add_filter( 'wpseo_indexable_excluded_post_types', [ $this, 'exclude_post_types' ] );
17 }
18
19 /**
20 * Exclude the post type from the indexable table.
21 *
22 * @param array $excluded_post_types The excluded post types.
23 *
24 * @return array The excluded post types, including the specific post type.
25 */
26 public function exclude_post_types( $excluded_post_types ) {
27 return \array_merge( $excluded_post_types, $this->get_post_type() );
28 }
29
30 /**
31 * This integration is only active when the child class's conditionals are met.
32 *
33 * @return array|string[] The conditionals.
34 */
35 public static function get_conditionals() {
36 return [];
37 }
38
39 /**
40 * Returns the names of the post types to be excluded.
41 * To be used in the wpseo_indexable_excluded_post_types filter.
42 *
43 * @return array The names of the post types.
44 */
45 abstract public function get_post_type();
46 }
47