Error on the CollectionPage category page

  • Error on the CollectionPage category page
    I forwarded the error I received specifically. Please I am waiting for your urgent help.
    The contents of my category page have @type and hasPart errors.
    I also made an important point! Each post headline and name on my category page is viewed as a category title.
    Actually, the name and headline are post names in my settings. Please help in this regard. because seo is negatively affected. there are ranking losses!

    • This topic was modified 1 week, 4 days ago by Trafiksozluk.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    You can add the following code snippet on your theme’s functions.php file to remove the collection page schema from this page:

    /**
     * Allow developers to remove snippet data from Taxonomies.
     *
     * @param bool $unsigned Default: false
     * @param string $unsigned Taxonomy Name
     */
    add_filter( 'rank_math/snippet/remove_taxonomy_data', function( $value, $taxonomy ) {
    	return $value; // true or false
    }, 10, 2);

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello Dear Authorized,
    Thank you for the answer you gave. However, I do not want to remove the schema structure.

    I also edited the function file, the error is not gone

    add_filter( ‘rank_math/json_ld’, function( $data, $jsonld ) {
    $parts = [];

    if ( isset( $data[‘CollectionPage’] ) ) {
    unset( $data[‘CollectionPage’][‘hasPart’] );
    while ( have_posts() ) {
    the_post();
    $post_id = get_the_ID();
    $schema = RankMath\Helper::get_post_meta( ‘rich_snippet’, $post_id );
    if ( ! $schema || ‘article’ !== $schema ) {
    continue;
    }

    $title = $jsonld->get_post_title( $post_id );
    $url = $jsonld->get_post_url( $post_id );
    $parts[] = [
    ‘@type’ => isset( $data[‘schema’] ) ? $data[‘schema’] : $schema,
    ‘headline’ => $title,
    ‘name’ => $title,
    ‘url’ => $url,
    ‘mainEntityOfPage’ => $url,
    ‘dateModified’ => get_post_modified_time( ‘Y-m-d\TH:i:sP’, true ),
    ‘datePublished’ => get_post_time( ‘Y-m-d\TH:i:sP’, true ),
    ‘author’ => $jsonld->get_author(),
    ‘publisher’ => $jsonld->get_publisher( $data ),
    ‘image’ => $jsonld->get_post_thumbnail( $post_id ),
    ‘keywords’ => $jsonld->get_post_terms( $post_id ),
    ‘commentCount’ => get_comments_number(),
    ‘comment’ => $jsonld->get_comments( $post_id ),
    ‘wordCount’ => str_word_count( get_the_content() ),
    ];
    }

    wp_reset_query();

    $data[‘CollectionPage’][‘hasPart’] = $parts;
    }

    return $data;
    }, 99, 2);

    Can such an arrangement be made?

    Hello,

    We are sorry but those issues are not created by Rank Math. There has to be something else on your website causing this.

    It seems like a conflict with one of the plugins or the theme you are using. To determine that, can you please follow this troubleshooting guide?

    Confirming a Theme/Plugin Conflict With Rank Math

    Only the site admin would know and your users won’t be affected by this troubleshooting.

    Dear Sir,

    Please try to approach the problem with a solution-oriented approach. I sent the link of my category page to you. There is an error in the contents listed on the category page. there are 4 values that I have determined and want to do.
    – haspart
    – type
    – name
    – headline

    I want to make a wordpress hook for these values. How can I add it as a hook?

    Hi Ahmet,

    As much as we would love to offer customized solution to each and every user we have, it just isn’t possible for a small company like ours with limited resources.

    If you have programming knowledge, you can use this filter to extend your Schema.

    We assume you have basic programming knowledge when you want to something like ask for a hook/filter.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this ticket.