Auto complete rich snippet

  • Hello,

    I was wondering if it was possible to pre-register %customfield(field-name)% type elements in the boxes of a rich snippet type so that they are automatically present in all pages/items that use it.

    This would be a great way to automate element filling when you have a well-defined base of elements that can be easily integrated into the rich snippet?

    Thank you for your answers!

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

    Thank you for getting in touch with us.

    You can customize the following filter to change front end schema.

    **
     * Filter to change the schema data.
     * Replace $schema_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_{$schema}_entity", function( $entity ) {
     return $entity;
    });

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    Thanks for your reply.

    I’m not sure where to put and how to use this code?

    Hello,

    The following is a sample application. Unfortunately if you are not good in programming you will have to seek help from one to customize this.

    
    **
     * Filter to change the schema data.
     * Replace $schema_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
    $thisName = /*your field value*/;  
    $entity['article'] = [
             'name'    => $thisName,
         ];
     return $entity;
    });

    Looking forward to helping you. Thank you

    Yes, I think I’m not good enough to understand it. 😅

    Except using a sample application like this, there is no way to create dynamic default values for rich snippets fields ?

    Thank you for your help !

    Hello,

    Right now, no. But I will submit that suggestion to our devs since I think you got a really good idea, thank you!

    Looking forward to help you.

    Thanks ! Hope it will come soon as it can make us save a lot of time ! 🙂

    Hello,

    I completely agree with you, it sounds like a really nice feature! Meanwhile, do you want we set the thread as solved? Don’t worry, we will be still here to help you with any other questions or issues you might have in the future.

    Looking forward to help you.

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

You must be logged in to reply to this ticket.