Yasr Filters and Actions


File: lib/yasr-ajax-functions.php

This is called before save the Overall Rating
do_action('yasr_action_on_overall_rating', $post_id, $rating);

This add new tabs in the Yasr Shortcode Creator
do_action( 'yasr_add_tabs_on_tinypopupform');

Add content for Yasr Shortcode Creator
do_action( 'yasr_add_content_on_tinypopupform')

Called before saving the visitor vote
do_action('yasr_action_on_visitor_vote', $post_id, $rating);

File: lib/yasr-functions.php

Run after default css are loaded
do_action( 'yasr_add_front_script_css' );

Run after yasr-front.js is loaded

For admin side: run before yasr-admin.css is loaded

For admin side: run after yasr-admin.css is loaded
do_action('yasr_add_admin_scripts_end' );

File: yasr-settings-functions.php

Add settings field in Aspect & Style page
do_action('yasr_style_options_add_settings_field', $style_options);

File: yasr-settings-page.php

Add new tab in the Yasr Settings
do_action( 'yasr_add_settings_tab', $active_tab )

Add content here for new page, the callback function must begin with
if ($active_tab == ‘YOURNEWPAGE’) {
do_action( 'yasr_settings_check_active_tab', $active_tab );

File: yasr-metabox-top-right.php

Add content at the bottom of the top right metabox used in the edit screen
do_action( 'yasr_add_content_bottom_topright_metabox', $post_id );


File: lib/yasr-functions.php

Use this filter to use your own rich snippets
$filtered_schema = apply_filters( 'yasr_filter_schema_jsonld', $review_choosen );

Filter the store ip address

File: yasr-settings-functions.php
Add content to the array $style_options used in the Aspect & Styles tab
apply_filters('yasr_filter_style_options', $style_options);

What do you think about this?
[Total: 38 Average: 3.8]

7 thoughts on “Yasr Filters and Actions

  • Hey Dario,

    i am using remove_filter('the_content', 'yasr_auto_insert_shortcode_callback'); and remove_filter('the_content', 'yasr_add_schema'); and after changing to my richsnippet
    add_filter('the_content', 'yasr_auto_insert_shortcode_callback', 3); and add_filter('the_content', 'yasr_add_schema', 3); to filter the output.

    After the last update the scheme is shown twice on the pages;)

    What have i to change?

    Best regards,

  • Could I request that you add another action in yasr-ajax-functions.php, after saving the visitor vote?

    In yasr_insert_visitor_votes_callback (), just above the die(), can you add:

    do_action(‘yasr_action_after_visitor_vote’, $post_id, $number_of_votes, $medium_rating);


  • Another plugin on my site prohibits the use of shortcodes at the location where I want to show the YASR rating. Is there an action I can use to get the same result as the [yasr_overall_rating] shortcode?

    • No sorry.
      If you need to disable shortcodes just in few pages, I use this code for this website, (added in the child theme)

      add_filter('the_content', 'yasr_website_remove_shortcode');

      function yasr_website_remove_shortcode ($content) {

      $exluded_ids = array(258, 13, 25);

      $post_id = get_the_ID();

      if (in_array($post_id, $exluded_ids)) {



      return $content;


Leave a Reply

Your email address will not be published. Required fields are marked *