Img Author in Schema

#746419
  • Resolved Anonymous
    Rank Math free

    Hello,

    I’m trying to make a custom schema, but I can’t find the variable to call the author image.

    I am doing this because Rank Math takes the image from Gravatar and in the help I see that they recommend a plugin, but I would prefer another plugin and do it from the schema creator.

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    I apologize for the inconvenience you are facing while trying to create a custom schema and include the author image. Unfortunately, Rank Math does not provide a specific variable to call the author image directly in the schema creator.

    Since Rank Math fetches the author image from Gravatar by default, if you prefer to use a different plugin or method to include the author image in your schema, you may need to manually add the image URL in the schema code using a custom solution.

    If you need further assistance or have any other questions, please feel free to ask.

    Thank you for raising this concern.

    Sources:
    How Does the Author Schema Entity Work? » Rank Math
    Product Schema Type » Rank Math
    How to Use Rank Math’s Custom Schema Generator » Rank Math
    Article Schema Type » Rank Math
    Setting a Custom Brand for Your WooCommerce Store with Rank Math » Rank Math

    Anonymous
    Rank Math free

    Hello,

    Could you give me the code?

    Thank you.

    Hello,

    Please share the affected author URL and the image you want to use in the schema so we can check and suggest the code to fetch a different image instead of the gravatar.

    You can add the URL in the sensitive data section

    Sensitive Data Section

    It is completely secure, and only our support staff has access to that section.

    Looking forward to helping you.

    Anonymous
    Rank Math free

    Hello,

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

    Thank you.

    Hello,

    Thank you so much for getting in touch.

    At the moment, Rank Math doesn’t have a variable to fetch the author’s avatar or profile image URL.

    You can however create a custom variable which lets you get that information.

    Here’s a custom variable function that we have created for you:

    add_action( 'rank_math/vars/register_extra_replacements', function(){
    	rank_math_register_var_replacement(
    	   'author_avatar', [
    	   'name'        => esc_html__( 'Author name', 'rank-math' ),
    	   'description' => esc_html__( 'Author description', 'rank-math' ),
    	   'variable'    => 'author_avatar', /* the actual variable: %author_avatar% */
    	   'example'     => author_avatar_call_back(),
    	   ],
    	   'author_avatar_call_back'
       );
    });
    function author_avatar_call_back(){
    	$theAuthorId = get_the_author_meta('ID');
    	$getUserUrl = get_avatar_url ($theAuthorId);
    	return $getUserUrl;
    }

    You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    After adding the filter code to your website, you can add this variable in your schema field: %author_avatar%.

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

    Anonymous
    Rank Math free

    Hello,

    Thanks for the interest, but it doesn’t work for me in the custom schema.

    Besides, when I put a custom schema I also get the default one. In other words, I get two articlenews schemas.

    Thanks.

    Anonymous
    Rank Math free

    Resolved. Thanks.

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post or TrustPilot about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘Img Author in Schema’ is closed to new replies.