- 1. init_plugin_suite_review_system_auto_insert_enabled_score
- 2. init_plugin_suite_review_system_auto_insert_enabled_vote
- 3. init_plugin_suite_review_system_default_score_shortcode
- 4. init_plugin_suite_review_system_default_vote_shortcode
- 5. init_plugin_suite_review_system_schema_type
- 6. init_plugin_suite_review_system_schema_data
- Conclusion
1. init_plugin_suite_review_system_auto_insert_enabled_score
Enable or disable the automatic insertion of the score block at specific positions in the post content.
Parameters:
bool $enabled– Default istruestring $position– Position such asbefore,afterstring $post_type– The current post type
// Disable auto-insert of score after post for 'product' post type
add_filter('init_plugin_suite_review_system_auto_insert_enabled_score', function($enabled, $position, $post_type) {
if ($post_type === 'product' && $position === 'after') {
return false;
}
return $enabled;
}, 10, 3);
2. init_plugin_suite_review_system_auto_insert_enabled_vote
Enable or disable the automatic insertion of the vote block before/after content or comment form.
Parameters: Same as above
// Prevent vote form from showing in comment section on 'page' post type
add_filter('init_plugin_suite_review_system_auto_insert_enabled_vote', function($enabled, $position, $post_type) {
if ($post_type === 'page') return false;
return $enabled;
}, 10, 3);
3. init_plugin_suite_review_system_default_score_shortcode
Customize the default shortcode for the score block when auto-insert is enabled.
Parameter: string $shortcode
// Add custom class when auto-inserting score
add_filter('init_plugin_suite_review_system_default_score_shortcode', function($shortcode) {
return '[init_review_score icon="true" class="highlight-score"]';
});
4. init_plugin_suite_review_system_default_vote_shortcode
Customize the default shortcode for the vote block when auto-insert is enabled.
Parameter: string $shortcode
// Enable schema by default for the vote block
add_filter('init_plugin_suite_review_system_default_vote_shortcode', function($shortcode) {
return '[init_review_system schema="true"]';
});
5. init_plugin_suite_review_system_schema_type
Adjust the schema.org type used in the vote block.
Parameters:
string $type– Default schema typestring $post_type– The current post type
// Change schema type to 'Movie' for movie posts
add_filter('init_plugin_suite_review_system_schema_type', function($type, $post_type) {
return $post_type === 'movie' ? 'Movie' : $type;
}, 10, 2);
6. init_plugin_suite_review_system_schema_data
Customize the JSON-LD schema content for the vote block.
Parameters:
array $schema_data– The generated schema dataint $post_id– Post IDstring $schema_type– Schema type in use
// Add 'author' field to schema
add_filter('init_plugin_suite_review_system_schema_data', function($schema, $post_id, $type) {
$schema['author'] = get_bloginfo('name');
return $schema;
}, 10, 3);
Conclusion
The hook system of Init Review System is simple yet flexible enough to let you customize display logic, schema integration, and vote handling behavior as needed.
Comments