
WPSSO version 3.37.0-2 has been released, along with updates to all its extensions. This latest WPSSO version includes several new options to fine-tune WPSSO’s internal caching features. The previous “Object Cache Expiry” option has been replaced with 7 new options:
- Head Markup Array Cache Expiry (default 3 days).
- Shortened URL Cache Expiry (default 1 week).
- List Column Content Cache Expiry (default 1 week).
- Filtered Content Text Cache Expiry (default 1 hour).
- Get Image (URL) Size Cache Expiry (default 1 day).
- Article Topics Array Cache Expiry (4 weeks).
- Schema Types Array Cache Expiry (4 weeks).
Several methods have been refactored / improved to cut down on the number of objects stored in the WordPress transient cache — instead of storing one object, an array of objects is stored instead (for example, one array element for http and another for https).
Support for the WPSSO_TRANSIENT_CACHE_DISABLE
, WPSSO_OBJECT_CACHE_DISABLE
, and WPSSO_FILE_CACHE_DISABLE
constants has been removed. To disable a caching feature (not recommended), you can set any of the new caching options to 0 seconds.
The Schema type https://schema.org/Thing has been added as the top-most parent for all other Schema types — WPSSO applies a filter to each Schema type parent, so Developers can hook a parent filter to modify the JSON of all its children. For example, hook the wpsso_json_data_https_schema_org_article
filter to modify the JSON of all 6 of its sub-types (NewsArticle, TechArticle, ScholarlyArticle, BlogPosting, Report, and SocialMediaPosting). Here’s some example code to retrieve an article headline from a post custom field.
1 2 3 4 5 6 7 8 9 10 |
add_filter( 'wpsso_json_data_https_schema_org_article', 'filter_json_data_https_schema_org_article', 10, 2 ); function filter_json_data_https_schema_org_article( $json_data, $mod ) { if ( $mod['is_post'] ) { $json_data['headline'] = get_post_meta( $mod['id'], '_custom_article_headline', true ); } return $json_data; } |
Documentation for the WPSSO $mod
variable is available in the Developer resource section.