how to create custom Variable for Schema, such as autor Profile Picture

#229586
  • Resolved hamed fallahi
    Rank Math free

    how to create custom Variable for using in Schema.
    such as autor Profile Picture, autor Facebook URL, autor Twitter username, autor website and email?

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math support today.

    Please refer to this code here to create a custom variable and use the shortcode %shortcode_var_name%:

    add_action( 'rank_math/vars/register_extra_replacements', function(){
    	rank_math_register_var_replacement(
    	   'shortcode_var_name', [
    	   'name'        => esc_html__( 'VAR name', 'rank-math' ),
    	   'description' => esc_html__( 'VAR description', 'rank-math' ),
    	   'variable'    => 'shortcode_var_name',
    	   'example'     => shortcode_var_name_call_back(),
    	   ],
    	   'shortcode_var_name_call_back'
       );
    });
    function shortcode_var_name_call_back(){
    	return "Value";
    }

    You may refer more here: https://rankmath.com/kb/filters-hooks-api-developer/

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

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘how to create custom Variable for Schema, such as autor Profile Picture’ is closed to new replies.