Skip to content

[Bug]: CPT not outputting author meta tag #23193

@UlrichThomasGabor

Description

@UlrichThomasGabor

Prerequisites

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

We have custom post types, which we basically use and want to behave like the default posts. We want to show the author meta tag for those.

This if here

if ( $this->presentation->model->object_sub_type !== 'post' ) {
return '';
}

blocks all logic and especially the filter execution a few lines below:
return \trim( $this->helpers->schema->html->smart_strip_tags( \apply_filters( 'wpseo_meta_author', $user_data->display_name, $this->presentation ) ) );

At the moment it is therefore not possible to use the existing code for non-default post types.

Can this be changed or should we use other means?

Step-by-step reproduction instructions

  1. Add a custom post type
  2. Create a post
  3. Add filter
add_filter(
    'wpseo_meta_author',
    static fn (string $author_name) => 'test',
);
  1. View the source => No meta author tag

Expected results

  1. Visible author meta tag

Actual results

  1. No author meta tag

Screenshots, screen recording, code snippet

No response

Which editor is affected (or editors)

  • Block Editor
  • Gutenberg Editor
  • Elementor Editor
  • Classic Editor
  • Other (please specify in additional info)

Which browser is affected (or browsers)

  • Chrome
  • Firefox
  • Safari
  • Other (please specify in additional info)

Device you are using

No response

Operating system

No response

PHP version

No response

WordPress version

6.9.4

WordPress Theme

No response

Yoast SEO version

27.4

Gutenberg plugin version (if relevant)

No response

Elementor plugin version (if relevant)

No response

Classic Editor plugin version (if relevant)

No response

Relevant plugins in case of a bug

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions