PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.4.1
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.4.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 / helpers / schema / article-helper.php

article-helper.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.4.1, at src/helpers/schema/article-helper.php

45 lines 1.3 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\Helpers\Schema;
4
5 /**
6 * Class Article_Helper.
7 */
8 class Article_Helper {
9
10 /**
11 * Determines whether a given post type should have Article schema.
12 *
13 * @param string|null $post_type Post type to check.
14 *
15 * @return bool True if it has Article schema, false if not.
16 */
17 public function is_article_post_type( $post_type = null ) {
18 if ( \is_null( $post_type ) ) {
19 $post_type = \get_post_type();
20 }
21
22 /**
23 * Filter: 'wpseo_schema_article_post_types' - Allow changing for which post types we output Article schema.
24 *
25 * @deprecated 17.6 - Just enable support for authors for the desired post type.
26 *
27 * @api string[] $post_types The post types for which we output Article.
28 */
29 \apply_filters_deprecated( 'wpseo_schema_article_post_types', [ [ 'post' ] ], 'WPSEO 17.6', '', 'Every post type supporting authors will automatically have the Article schema enabled.' );
30
31 return $this->is_author_supported( $post_type );
32 }
33
34 /**
35 * Checks whether author is supported for the passed object sub type.
36 *
37 * @param string $object_sub_type The sub type of the object to check author support for.
38 *
39 * @return bool True if author is supported for the passed object sub type.
40 */
41 public function is_author_supported( $object_sub_type ) {
42 return \post_type_supports( $object_sub_type, 'author' );
43 }
44 }
45