Okay
  Public Ticket #4309495
How to add sponser person in schema?
Open

Comments

  • Kevin started the conversation

    Hi,

    I have a news website and I want to add sponsor data in the schema, so which dynamic data do I need to use for that? like this 

    NewsArticle

    @type
    NewsArticle

    abstract
    Why more enterprises are turning to CryptoProcessing by CoinsPaid.

    articleSection
    Sponsored Content

    dateModified

    datePublished
    2025-07-31T19:10:19.770Z

    headline
    Crypto Payments Are No Longer Speculative Risk Assets – They’re Infrastructure

    identifier
    7e364e38-12e6-49be-853d-4b66d6d1af8b

    inLanguage
    en

    mainEntityOfPage
    https://www.coindesk.com/sponsored-content/crypto-payments-are-no-longer-speculative-risk-assets-they-re-infrastructure

    thumbnailUrl
    https://cdn.sanity.io/images/s3y3vcno/production/12b468aaa7bed1cf3de7a2469d372f6138a76a8b-1920x1080.png?auto=format

    url
    https://www.coindesk.com/sponsored-content/crypto-payments-are-no-longer-speculative-risk-assets-they-re-infrastructure

    author @type Person

    description jobTitle Author name CoinDesk url https://www.coindesk.com/author/coindesk

    worksFor

    image @type ImageObject url https://cdn.sanity.io/images/s3y3vcno/production/12b468aaa7bed1cf3de7a2469d372f6138a76a8b-1920x1080.png?auto=format publisher

    Like this -> sponsor 

     @type Organization 

     name CoinsPaid 

     url https://coinspaid.com/

    How to include type, name, and URL dynamically in RankMath?

    Like this: %primary_taxonomy_terms%

    Thank You



  •  335
    Theme Ruby replied

    Thank you for reaching out!

    We’d like to know if you are using any SEO plugin, such as Rank Math SEO. This information will help us provide an accurate answer to your question.

    Regards,

  • Kevin replied

    Yes, I have mentioned that we're using rankmath plugin.

  •  335
    Theme Ruby replied

    Hi,

    Thank you for your question.

    Since you're using the Rank Math SEO plugin, the schema for your posts is handled directly by the plugin. We’ve taken a look into their code to better understand how the schema is generated, but due to its complexity, we're unable to confirm whether adding custom schema elements, like sponsor data. is possible through code alone.

    In this case, we recommend reaching out to the Rank Math support team to check if they offer a way to add sponsor information via their schema settings or filters.

    If there's anything else we can assist you with regarding the theme, please feel free to let us know, we're happy to help.

    Best regards,

  • Kevin replied

    Hi,

    I am actually looking for your help because your theme has a setting to replace metadata with sponsor details.

    I am also writing to RankMath as well.

    Thank You


  •  335
    Theme Ruby replied

    Hi,

    Sorry for the inconvenience. The theme’s built-in schema function support sponsor schema. However, in your case, the schema is handled by a third-party plugin, so it’s outside of our direct control.

    If the plugin author provides a hook, you can add the sponsor schema by placing custom code in your child theme’s functions file. For example:

    add_filter( 'hook_from_plugin', 'add_sponsor_meta', 10, 1 );
    
    function add_sponsor_meta( $json_ld ) {
        $sponsor = rb_get_meta( 'sponsor_post', $post_id );
        if ( ! empty( $sponsor ) && '1' === (string) $sponsor ) {
            $sponsor_logo_id = rb_get_meta( 'sponsor_logo', $post_id );
            $sponsor_name    = rb_get_meta( 'sponsor_name', $post_id );
    
            $json_ld['sponsor'] = [
                '@type' => 'Organization',
                'url'   => esc_url( rb_get_meta( 'sponsor_url', $post_id ) ),
            ];
    
            if ( ! empty( $sponsor_name ) ) {
                $json_ld['sponsor']['name'] = $sponsor_name;
            }
    
            if ( ! empty( $sponsor_logo_id ) ) {
                $logo_url = wp_get_attachment_image_url( $sponsor_logo_id, 'full' );
                if ( $logo_url ) {
                    $json_ld['sponsor']['logo'] = [
                        '@type' => 'ImageObject',
                        'url'   => esc_url( $logo_url ),
                    ];
                }
            }
        }
    
        return  $json_ld;
    }

    Thanks!