Support » Plugin: Yoast SEO » Bug when overriding wpseo_schema_article_post_types

  • Resolved thoth75370

    (@thoth75370)


    When trying to override the schema for a custom post type (CPT) and tell Yoast (version 11.8) it is an “Article”, you need to add a filter in your functions.php:

    function schema_article_post_types($post_types) {
    	$post_types = array('long_form', 'post');
    	return $post_types;
    }
    add_filter( 'wpseo_schema_article_post_types', 'schema_article_post_types');

    It works for adding the “Article” type but it fails to add the required “Author”. In the file ./frontend/schema/class-schema-author.php on line 99 the code references a filter that does not exist:
    $post_types = apply_filters( 'wpseo_schema_article_post_type', array( 'post' ) );

    wpseo_schema_article_post_type should be plural “wpseo_schema_article_post_types“.

    $post_types = apply_filters( 'wpseo_schema_article_post_types', array( 'post' ) );

    • This topic was modified 1 year, 11 months ago by thoth75370.
    • This topic was modified 1 year, 11 months ago by thoth75370.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support amboutwe

    (@amboutwe)

    Based on the information you provided, we expect this to be a bug. We’re actively using the bug tracking on our GitHub repository so your best next step would be to create a new issue for our developers here. You will need an account to create a new issue. Don’t forget to include the URL to this conversation in your bug report.

    If you have not submitted an issue previously, this guide will help you submit a complete report which may result in a faster resolution.

    Plugin Support devnihil

    (@devnihil)

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug when overriding wpseo_schema_article_post_types’ is closed to new replies.