Add new fields

  • I have added some codes to the schema in the file link attached to sensitive data. Now, I want to add the fields for the added properties without affecting the plugin capability. Also, I want these settings to be permanently present in the schema with any modifications required after updating the plugin. Thanks!

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

    Thank you for contacting Rank Math today.

    You can hook into the following filter to extend the currently available schema with your custom attributes:

    /**
     * Collect data to output in JSON-LD.
     *
     * @param array  $unsigned An array of data to output in json-ld.
     * @param JsonLD $unsigned JsonLD instance.
     */
    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	return [];
    }, 10, 2);

    Adding the code to your theme’s functions.php file will ensure that it does not get overwritten after a new plugin update.

    Looking forward to helping you. Thank you.

    ​​​​​​

    I had checked this before but could not understand how to add new fields and the format to add the code. It would be great if you extracted some added fields in the above PHP file I attached and add 2-3 lines of codes in the filter you have provided.

    Best,
    Pravesh Khanal

    Hi Pravesh,

    Here is a template you can use:
    https://support.rankmath.com/ticket/how-to-add-organization-schema-to-rich-snippet-tab/?view=all#post-23498

    As much as we would love to offer customized solution to each and every user we have, it just isn’t possible for a small company like ours with limited resources.

    You can hire a programmer if you wish to extend the features we offer in Rank Math.

    Hello,

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

    Thank you.

    I added the code in sensitive data and encountered the error with the error as mentioned. Even after removing the added schema codes in functions.php and restoring the rank math backup, the error is still there. Thanks!

    Hi there,

    Thank you for getting back to us.

    I don’t think that this is related to the code snippet since the schema data will only be added to the frontend of your site.

    Could you please check whether the Local SEO option is set to Person via Rank Math > Titles & Meta > Local SEO > Person or Company?

    Assuming you are using the latest version of all the plugins and the themes (please update if not yet), it would seem like a conflict with one of the plugins or the theme you are using.

    To determine that, please follow this troubleshooting guide:
    https://rankmath.com/kb/check-plugin-conflicts/

    Please let us know if you find the culprit.

    Only the site admin would know and your users won’t be affected by this troubleshooting.

    Looking forward to helping you.

    It is set to Person.

    I am attaching my wp login details so that you can reproduce the problem. This happened immediately after I added the code to functions.php and I am 100% sure that there is something incorrect.

    Please add a new post; I have set the default schema to person but no schema will be selected. When I select any other schema, it works well but person schema encounters an error. Please do not do this on my old posts as the post will be immediately deleted after the conflict.

    funtions.php coding:
    start: Line 145
    end: Line 172

    Hello,

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

    Thank you.

    I meant to say it is not* set to Person.
    The ‘organization’ option is selected.

    Even after disabling all the plugins except Rank Math and enabling the 2020 theme, the issue still exists in troubleshooting mode.

    Hi, I am waiting for your response. I have tried a lot for fixing it but the issue always exists.

    I am waiting for your response.

    Hi Pravesh,

    As much as we would love to offer customized solution to each and every user we have, it just isn’t possible for a small company like ours with limited resources.

    We have provided you the filter, you will have to edit and add it yourself. Or, you can hire a coder to do that for you. Unfortunately, we cannot offer extensive support for features not present in the plugin.

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

    I will do everything on my own but I need your support to fix the error I am getting. Please try to get what I am asking for.

    I am not asking the support team to do every customization I want.

    I want to add some boxes to the schema in WordPress posts and pages. I added the code on my own which I have already provided above. I have inserted it successfully but ran into a problem that I cannot fix. Even after removing the code added, the problem is not fixed. Please try to understand me. I feel so bad to get such reply from the plugin developers. I have been using this plugin on all of my sites since it has been released.

    Also, can you please do the hard work of providing me the code of adding only one field; ONLY ONE. Like I want to add a field for the property ‘birthDate’; please show me the example only for this field. After getting a little idea, I can do the rest work on my own. Even if you feel that this is difficult, please see the code I have provided above which didn’t work for me and I am facing the problem which doesn’t allow me to add some schemas. You can edit only one line of code and reply. Thanks!

    Even if your reply is still the same, please teach me the way to revert back the schemas to default. I cannot fix the issue even after deleting the code I have added.

Viewing 15 replies - 1 through 15 (of 24 total)

The ticket ‘Add new fields’ is closed to new replies.