Support Trafiksozluk

Trafiksozluk

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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?

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

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

    Hello,

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

    Thank you.

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