the_content() article body the schema ?

#597660
  • Resolved Rayadu
    Rank Math free

    the_content() article body for schema ?
    like title means %seo_title%
    and
    description like %seo_description%
    the_content() like ?

    thanks for reply

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for reaching out to us.

    We don’t have a variable in the plugin to add the entire content of the page but you can create one by adding the following filter on your website:

    add_action( 'rank_math/vars/register_extra_replacements', function(){
        rank_math_register_var_replacement(
            'content_area',
            [
                'name' => esc_html__( 'Full Content', 'rank-math' ),
                'description' => esc_html__( 'Get the full content area', 'rank-math' ),
                'variable' => 'content_area',
                'example' => 'content_area_callback()',
            ],
            'content_area_callback'
        );
    });
    
    function content_area_callback() {
        $content = strip_tags(wpautop(get_the_content()));
        return $content;
    }

    The %content_area% variable can be used to get the full content in your schema.

    Here’s how you can add filters/hooks to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.