Support » Plugin: Schema » Modify/Extend code not working

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Hesham Zebida


    I think the reason why the filter isn’t working is that Schema plugin still reads the old data which is saved in post meta, or maybe your pages are cached.

    Can you try saving the plugin settings once, then check if this solves the issue. Also, if you are running a cache plugin try delete cache.

    Thanks for the quick reply.

    It doesn’t work on my localhost (MAMP server, Webpack, yarn) which doesn’t do any caching.

    I have saved the plugin settings, upgraded from 1.6.x to 1.7, and turning Use Yoast Schema off and on, thinking there might be a conflict.

    Oddly enough it does seem to work when I publish the code to my production site. I pushed only unset( $schema['author'] ); code to the production server and the author field does seem suppressed on this article page.

    This makes it hard to develop and test customizations, but at least it works.

    Any thoughts on why it wouldn’t work locally?

    • This reply was modified 9 months, 3 weeks ago by  slamorte.

    Hi again,

    Yes, it’s the post_meta.

    I checked the post_meta field and the custom schema is written to post_meta the first time the schema modify code is used. If the modification code uses $schema['author'] = 'foo', then "Author":"Foo" is written to post_meta.

    However, modifying the code and reloading the page does not rewrite the post_meta field. Schema is pulling the post_meta version of the schema rather than rebuilding it from the updated code. If I update the code to $schema['author'] = 'bar', and reload the page, "Author":"Foo" is still displayed.

    I can delete the post_meta entry and reload the page and see the updated results, but this make testing and development rather slow.

    The modification code may need an additional function that removes the post_meta or expires the post_meta (I see there is a _schema_json_timestamp field which I assume is used to expire the _schema_json)

    Plugin Author Hesham Zebida


    I understand what you mean.. Yes, the saved _schema_json post meta value expires after 24 hours.

    Also it got deleted on some occasions, example:

    – If you updated the post.
    – If a new comment is submitted on a post.
    – If you update Schema -> Type.
    – If you updated the plugin settings.

    So, maybe update the post or plugin settings will come more handy when developing.



    Thanks Hesham!

    Those are some good workaround to this issue. Now that I know what the issue is I can probably figure out other workarounds.

    If I could request a feature it would be for a function that forces schema updates sitewide during development. Something like:


    Or optionally force it on one post:

    force_schema_cache_rebuild( post_id )

    There is a WordPress function that would work for a single post at ID 1234:

    delete_post_meta( 1234, '_schema_json_timestamp' );

    A variant of that might work for a more general schema cache clearing:

    function force_schema_cache_rebuild {
      $post_id = get_the_ID();
      if( ! empty( $post_id ) {
        delete_post_meta( get_the_ID(), '_schema_json_timestamp' );

    But I have not tested this.

    I just finished writing code that populates $schema['author'] with multiple authors from an ACF relationship field. It works great but took ages to test without a schema cache clear during the 20 or so revisions it took me to get it rights.

    Thanks again for a great plugin!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Modify/Extend code not working’ is closed to new replies.