Support » Plugin: Schema » Catch and filter-All schema json arrays before output

  • Resolved Jonas Lundman

    (@jonas-lundman)


    This is a notice not a bug. We are missing filters for the author and search json output, would it be possible to add such in future release? And a catch all filter would be nice. For now, we end up like this:

    add_filter('schema_output', 'entex_monitor_collect_schema_plugin_schema', 99);
    add_filter('schema_about_page_output', 'entex_monitor_collect_schema_plugin_schema', 99);
    add_filter('schema_json_ld_breadcrumb_array', 'entex_monitor_collect_schema_plugin_schema', 99);
    add_filter('schema_contact_page_output', 'entex_monitor_collect_schema_plugin_schema', 99);
    add_filter('schema_taxonomy_json', 'entex_monitor_collect_schema_plugin_schema', 99);
    add_filter('schema_tag_json', 'entex_monitor_collect_schema_plugin_schema', 99);
    add_filter('schema_category_json', 'entex_monitor_collect_schema_plugin_schema', 99);
    add_filter('schema_wp_knowledge_graph_json', 'entex_monitor_collect_schema_plugin_schema', 99);
    add_filter('schema_blog_output', 'entex_monitor_collect_schema_plugin_schema', 99);
    /* added in core file author and search */
    add_filter('FIX_schema_plugin', 'entex_monitor_collect_schema_plugin_schema', 99);

    The filter(s) make it possible to change or inject one or more properites. A catch all filter at the end of each core LAST output function would prefered like this:

    $type = 'blog';
    // or
    $type = 'taxonomy';
    $schema = apply_filters('schema_all_output', $schema, $type);
    $output = '<script .. json_encode($schema):..

    Thanks

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

    (@hishaman)

    I have plans to re-code the output functions, I think all markup generated by the plugin should be output through one single function, I will put this for next update.

    For now, I’ve added the missing filter for search and author and pushed a plugin update:

    – schema_sitelinks_search_box_output
    – schema_author_output

    Thanks for the heads up.

    Thread Starter Jonas Lundman

    (@jonas-lundman)

    No worries, thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Catch and filter-All schema json arrays before output’ is closed to new replies.